{"record":{"id":"8c26e584aade8cee","repo":"router-for-me/CLIProxyAPI","slug":"vertex-credential-create-directory-failed-w","errorCode":null,"errorMessage":"vertex credential: create directory failed: %w","messagePattern":"vertex credential: create directory failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/auth/vertex/vertex_credentials.go","lineNumber":61,"sourceCode":"func (s *VertexCredentialStorage) SetMetadata(meta map[string]any) {\n\ts.Metadata = meta\n}\n\n// SaveTokenToFile writes the credential payload to the given file path in JSON format.\n// It ensures the parent directory exists and logs the operation for transparency.\nfunc (s *VertexCredentialStorage) SaveTokenToFile(authFilePath string) error {\n\tmisc.LogSavingCredentials(authFilePath)\n\tif s == nil {\n\t\treturn fmt.Errorf(\"vertex credential: storage is nil\")\n\t}\n\tif s.ServiceAccount == nil {\n\t\treturn fmt.Errorf(\"vertex credential: service account content is empty\")\n\t}\n\t// Ensure we tag the file with the provider type.\n\ts.Type = \"vertex\"\n\n\tif err := os.MkdirAll(filepath.Dir(authFilePath), 0o700); err != nil {\n\t\treturn fmt.Errorf(\"vertex credential: create directory failed: %w\", err)\n\t}\n\n\tdata, errMerge := misc.MergeMetadata(s, s.Metadata)\n\tif errMerge != nil {\n\t\treturn fmt.Errorf(\"vertex credential: merge metadata failed: %w\", errMerge)\n\t}\n\n\tf, err := os.Create(authFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"vertex credential: create file failed: %w\", err)\n\t}\n\tdefer func() {\n\t\tif errClose := f.Close(); errClose != nil {\n\t\t\tlog.Errorf(\"vertex credential: failed to close file: %v\", errClose)\n\t\t}\n\t}()\n\tenc := json.NewEncoder(f)\n\tenc.SetIndent(\"\", \"  \")","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/auth/vertex/vertex_credentials.go#L43-L79","documentation":"Returned by VertexCredentialStorage.SaveTokenToFile when os.MkdirAll on the parent of the auth file path fails (vertex_credentials.go:59-62). Analogous to the Kimi variant: the directory that should hold the vertex credential JSON cannot be created due to permissions, read-only filesystem, or a conflicting file along the path.","triggerScenarios":"auths directory on a read-only rootfs or volume; path component exists as a regular file; process user lacks write permission on the deepest existing directory.","commonSituations":"Kubernetes/Docker deployments not mounting auths/ writable; running as nobody against root-owned /app/auths; typos in a custom auth file path such as auths/vertex.json/extra.","solutions":["Ensure the parent directory of the configured auth path exists and is writable: mkdir -p auths && chmod 700 auths","Mount the auths volume read-write in the container","Fix or remove conflicting files along the path (a file named like a directory component)"],"exampleFix":"# before\n/app/auths: Read-only file system\n# after (compose)\nvolumes: [\"./auths:/app/auths\"]","handlingStrategy":"validation","validationCode":"dir := filepath.Dir(authFilePath)\nif err := os.MkdirAll(dir, 0o700); err != nil {\n    return fmt.Errorf(\"auth dir %q not creatable: %w\", dir, err)\n}","typeGuard":null,"tryCatchPattern":"if err := s.SaveTokenToFile(path); err != nil && strings.Contains(err.Error(), \"create directory failed\") {\n    log.Errorf(\"auth volume not writable: %s\", filepath.Dir(path))\n}","preventionTips":["Mount auths/ read-write in container deployments","Pre-create auth dirs with correct ownership in setup scripts","Health-check the auth dir at startup"],"tags":["filesystem","vertex","auth","permissions"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}