{"record":{"id":"e79b9196999656a9","repo":"chenhg5/cc-connect","slug":"chmod-plist-w","errorCode":null,"errorMessage":"chmod plist: %w","messagePattern":"chmod plist: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/launchd.go","lineNumber":67,"sourceCode":"\t\treturn fmt.Errorf(\"create log dir: %w\", err)\n\t}\n\n\t// Unload existing service first (ignore errors) so we do not leave a stale\n\t// job behind when switching between GUI and headless sessions.\n\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) {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/daemon/launchd.go#L49-L85","documentation":"launchd Install wraps os.Chmod failure when hardening the launchd plist to 0600. WriteFile's perm only applies on create, so Chmod is required to tighten plists that pre-existed at 0644 and may contain captured secrets.","triggerScenarios":"Thrown at daemon/launchd.go:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check ownership/permissions of ~/Library/LaunchAgents and the plist file","Remove the stale plist and reinstall the service"],"exampleFix":null,"handlingStrategy":"try-catch","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"}