Skip to content

Windows: --profile-dir fails while syncing parent directory (os error 5) #666

Description

@zhouzirui-2026

Summary

On Windows, Moli v1.1.8 exits during startup whenever serve uses a fresh --profile-dir. Profile initialization writes profile.json, then fails while syncing the parent directory with Access Denied (os error 5). Starting the same binary without --profile-dir remains running.

Environment

  • Moli: v1.1.8 official moli-x86_64-pc-windows-msvc.zip
  • archive SHA-256 verified: 09fba722f93984ae74ce357bb31920a9ce439b7e24f15ca1a1381217d7286660
  • Windows x86_64
  • tested with fresh profile directories under ordinary %TEMP% and a separate scratch directory

No existing browser profile, cookies, or imported auth state are involved.

Reproduction

$root = Join-Path $env:TEMP ("moli-profile-repro-" + [guid]::NewGuid().ToString("N"))
$profile = Join-Path $root "profile"
New-Item -ItemType Directory -Force -Path $profile | Out-Null

.\moli.exe serve `
  --host 127.0.0.1 `
  --port 32174 `
  --profile-dir $profile `
  --layout `
  --log-level error

Observed stderr:

Error: failed to initialize browser profile manifest `<profile>\profile.json`: failed to sync profile manifest parent directory `<profile>`: Access is denied. (os error 5)

Control:

.\moli.exe serve --host 127.0.0.1 --port 32175 --layout --log-level error

The no-profile control remains running, so the failure is specific to persistent profile initialization.

Suspected source

In v1.1.8 (and current main), moli-browser-profile/src/atomic_write.rs calls:

fs::File::open(parent)
    .and_then(|directory| directory.sync_all())

after renaming the temporary manifest. On Windows, opening a directory through the normal File::open path appears to produce the observed Access Denied, so the directory durability step prevents profile creation even though the manifest file itself was written/replaced.

A platform-specific directory-open/sync implementation (or reviewed Windows durability equivalent) may be needed. A regression that executes write_file_atomically() with a real temporary directory on Windows would catch this.

I can retest a patch/release on Windows if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions