{"record":{"id":"554432a5f27367a4","repo":"plandex-ai/plandex","slug":"error-creating-account-credentials-directory-v","errorCode":null,"errorMessage":"error creating account credentials directory: %v","messagePattern":"error creating account credentials directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/model_credentials.go","lineNumber":574,"sourceCode":"\n// emoji for satisfied vs missing\nfunc mark(ok bool) string {\n\tif ok {\n\t\treturn \"✅\"\n\t}\n\treturn \"❌\"\n}\n\nvar cachedAccountCredentials *types.AccountCredentials\n\nfunc SetAccountCredentials(creds *types.AccountCredentials) error {\n\tif auth.Current == nil {\n\t\treturn fmt.Errorf(\"no authenticated user\")\n\t}\n\tdir := filepath.Join(fs.HomePlandexDir, auth.Current.UserId, auth.Current.OrgId)\n\terr := os.MkdirAll(dir, 0700)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating account credentials directory: %v\", err)\n\t}\n\tpath := filepath.Join(dir, \"creds.json\")\n\tbytes, err := json.MarshalIndent(creds, \"\", \"  \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshalling account credentials: %v\", err)\n\t}\n\terr = os.WriteFile(path, bytes, 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing account credentials: %v\", err)\n\t}\n\n\tcachedAccountCredentials = creds\n\n\treturn nil\n}\n\nfunc GetAccountCredentials() (*types.AccountCredentials, error) {\n\tif cachedAccountCredentials != nil {","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/model_credentials.go#L556-L592","documentation":"SetAccountCredentials creates the directory <HomePlandexDir>/<UserId>/<OrgId> with 0700 permissions to hold creds.json. This error wraps os.MkdirAll failure — the credentials file cannot be stored because the per-user credentials directory could not be created.","triggerScenarios":"os.MkdirAll fails for HomePlandexDir or a subpath: parent directory doesn't exist and can't be created, permission denied, path is a file, disk full, or read-only filesystem.","commonSituations":"HOME or the Plandex home dir env var overridden to a non-writable path; a regular file occupying the directory path; running as different user than the one who created ~/.plandex with restrictive ownership; read-only container filesystem.","solutions":["Check that the Plandex home directory (fs.HomePlandexDir) exists and is writable by the current user.","ls the path from the wrapped error: if a file occupies the directory path, remove/rename it.","Fix ownership/permissions (chown/chmod) on the home directory, or correct the env var pointing HomePlandexDir at a bad location.","Ensure the filesystem isn't full or mounted read-only."],"exampleFix":"// before: no pre-check\n// after: verify writability before storing creds\nif info, err := os.Stat(fs.HomePlandexDir); err == nil && !info.IsDir() {\n    return fmt.Errorf(\"%s exists and is not a directory\", fs.HomePlandexDir)\n}","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(fs.HomePlandexDir); err == nil && !info.IsDir() {\n    return fmt.Errorf(\"%s exists and is not a directory\", fs.HomePlandexDir)\n}\nif f, err := os.OpenFile(fs.HomePlandexDir, os.O_RDWR, 0700); err != nil {\n    return fmt.Errorf(\"plandex home dir not writable: %w\", err)\n} else {\n    f.Close()\n}","typeGuard":null,"tryCatchPattern":"if err := SetAccountCredentials(creds); err != nil {\n    if strings.Contains(err.Error(), \"creating account credentials directory\") {\n        return fmt.Errorf(\"cannot create credentials dir — check ownership/permissions on your plandex home directory: %w\", err)\n    }\n    return err\n}","preventionTips":["Ensure the plandex home directory env/HOME is not overridden to a read-only or foreign-user path.","Check that no regular file occupies the expected directory path.","Run the CLI as the same user that owns the home directory.","Verify free disk space before credential operations."],"tags":["filesystem","permissions","io"],"backgroundTag":"permission-denied","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}