Skip to content

NSUserDefaults warning: app passes own bundle identifier as suite name #88909

Closed

Description

@onlinejourno

On macOS launch, app logs:

OpenClaw[...] Using your own bundle identifier as an NSUserDefaults suite name does not make sense and will not work. Break on _NSUserDefaults_Log_Nonsensical_Suites to find this

Version: 2026.5.28
macOS: Darwin 25.5 (Sequoia)
Bundle ID: ai.openclaw.mac

Cause: UserDefaults(suiteName:) is called with Bundle.main.bundleIdentifier. A suite name must differ from the app's own bundle ID; otherwise the init no-ops and falls back to standard defaults, and macOS logs the warning above.

Fix: use UserDefaults.standard, or a distinct app-group suite (e.g. group.ai.openclaw) if defaults need to be shared with a helper/extension.

Impact: cosmetic — stderr noise only, preferences still persist.

Activity

  1. onlinejourno commented on Jun 1, 2026

    @onlinejourno
    Author

    Environment where I hit this:

    • OpenClaw: 2026.5.28 (build 2026052890)
    • macOS: 26.5 (build 25F71)
    • Arch: arm64 (Apple Silicon); app binary is universal (x86_64 + arm64)
    • Min OS target: 15.0
    • Bundle ID: ai.openclaw.mac

    Reproduced on every launch, both via open -a OpenClaw and running the binary directly.

  2. onlinejourno commented on Jun 1, 2026

    @onlinejourno
    Author

    Workaround (until a fix ships): none needed for normal use — the warning is cosmetic, defaults fall back to standard and preferences still persist.

    If the log noise is annoying when launching from a terminal, suppress the system framework logging:

    OS_ACTIVITY_MODE=disable /Applications/OpenClaw.app/Contents/MacOS/OpenClaw

    This only quiets the stderr line; it does not change app behavior. The real fix still belongs in code (UserDefaults.standard or a distinct group.* suite).

  3. clawsweeper commented on Jun 1, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 1, 2026, 6:49 AM ET / 10:49 UTC.

    Summary
    Current main still opens a defaults suite named ai.openclaw.mac on the macOS Nix-mode launch path, and that name is also the reported app identifier. This remains a narrow, source-reproducible cosmetic defect; a focused repair should preserve the existing Nix stable-suite contract rather than replacing all reads with standard defaults.

    Reproducibility: yes. from source: every evaluation of isNixMode constructs the self-named suite, and two users reported the warning on released macOS app launches. This read-only Linux checkout cannot perform the native runtime launch confirmation.

    Next step
    Current source proves a small existing-behavior defect, the affected files and tests are clear, and no confirmed open PR currently owns the repair.

    Review details

    Best possible solution:

    Use standard defaults when the stable Nix domain equals the running app’s bundle identifier, while retaining the stable-suite lookup for renamed app bundles, with regression coverage for both paths.

    Do we have a high-confidence way to reproduce the issue?

    Yes, from source: every evaluation of isNixMode constructs the self-named suite, and two users reported the warning on released macOS app launches. This read-only Linux checkout cannot perform the native runtime launch confirmation.

    Is this the best way to solve the issue?

    Yes: a conditional stable-suite lookup preserves the existing Nix contract while avoiding the self-suite construction; an unconditional UserDefaults.standard replacement would not be the best fix.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The repair must prove both the normal matching-identifier path and the renamed-bundle Nix path; removing the stable lookup wholesale would make Nix mode undiscoverable after bundle-identifier churn.

    Codex review notes: model internal, reasoning high; reviewed against a88f3ffc9609.

    Label changes

    Label changes:

    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
    • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.
    • remove clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.
    • remove issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.

    Label justifications:

    • P3: The observed effect is cosmetic stderr noise; reporters state that preferences still persist and normal operation continues.
    • impact:other: This is a concrete native macOS launch-diagnostics issue that does not fit the specialized message, session, provider, security, or crash labels.
    Evidence reviewed

    Acceptance criteria:

    • cd apps/macos && swift test --filter NixModeStableSuiteTests
    • Launch the packaged macOS app with bundle identifier ai.openclaw.mac and verify that the NSUserDefaults self-suite warning is absent.
    • Exercise a renamed-bundle fixture or focused test where the stable ai.openclaw.mac domain still enables Nix mode.

    What I checked:

    Likely related people:

    • Peter Steinberger: Current-line blame maps the Nix defaults resolution and suite creation to 02419ed1998feeaeaca21a92de7d23e805742f13. (role: recent contributor on the current path; confidence: medium; commits: 02419ed1998f; files: apps/macos/Sources/OpenClaw/ProcessInfo+OpenClaw.swift)
    • joshp123: The provided merged PR context identifies this contributor as the author of the stable Nix defaults-suite behavior that the repair must preserve. (role: related stable-suite contributor; confidence: medium; commits: 69aa3df116d3; files: apps/macos/Sources/OpenClaw/ProcessInfo+OpenClaw.swift, apps/macos/Tests/OpenClawIPCTests/NixModeStableSuiteTests.swift)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. added
    P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on Jun 1, 2026
  5. mingtsay commented on Jun 3, 2026

    @mingtsay

    I can confirm the issue on my Mac with latest (v2026.5.28) OpenClaw app.

    -> % cat /tmp/openclaw/openclaw-stdout.log
    2026-06-02 15:59:47.173 OpenClaw[2256:19247] Using your own bundle identifier as an NSUserDefaults suite name does not make sense and will not work. Break on _NSUserDefaults_Log_Nonsensical_Suites to find this
    
  6. added
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    on Jun 19, 2026
  7. added
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    and removed
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    on Jul 29, 2026
  8. self-assigned this
    on Aug 1, 2026
  9. locked as resolved and limited conversation to collaborators on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions