{"record":{"id":"524b411e0b29f1b0","repo":"chenhg5/cc-connect","slug":"launchctl-bootstrap-s-w","errorCode":null,"errorMessage":"launchctl bootstrap: %s (%w)","messagePattern":"launchctl bootstrap: (.+?) \\(%w\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/launchd.go","lineNumber":72,"sourceCode":"\tbootoutLaunchdTargets()\n\n\tplist := buildPlist(cfg)\n\t// 0600: plist may contain captured secret values (config.toml ${ENV}\n\t// placeholders and any EnvDiscoverer extension output). User-only\n\t// LaunchAgents path; root can still read but that is the user's own\n\t// machine boundary. os.WriteFile only applies perm on create, so\n\t// Chmod afterwards is required to harden reinstalls of files that\n\t// pre-existed at 0644 from earlier cc-connect versions.\n\tif err := os.WriteFile(plistPath, []byte(plist), 0600); err != nil {\n\t\treturn fmt.Errorf(\"write plist: %w\", err)\n\t}\n\tif err := os.Chmod(plistPath, 0600); err != nil {\n\t\treturn fmt.Errorf(\"chmod plist: %w\", err)\n\t}\n\n\tdomain := preferredLaunchdDomain()\n\tif out, err := runLaunchctl(\"bootstrap\", domain, plistPath); err != nil {\n\t\treturn fmt.Errorf(\"launchctl bootstrap: %s (%w)\", out, err)\n\t}\n\n\tif _, err := runLaunchctl(\"kickstart\", \"-kp\", launchdTarget(domain)); err != nil {\n\t\treturn fmt.Errorf(\"launchctl kickstart: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (m *launchdManager) Uninstall() error {\n\tbootoutLaunchdTargets()\n\n\tplistPath := launchdPlistPath()\n\tif err := os.Remove(plistPath); err != nil && !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"remove plist: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/daemon/launchd.go#L54-L90","documentation":"launchd Install wraps launchctl bootstrap failure including launchd's output: the plist was written but could not be loaded into the domain (commonly the asynchronous 'Bootstrap failed: 5' race or wrong GUI/headless domain).","triggerScenarios":"Thrown at daemon/launchd.go:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run install; it is idempotent after bootout","Validate the plist with plutil and confirm the correct launchd domain"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}