{"record":{"id":"f39a4f4d7a4ab88e","repo":"weaviate/weaviate","slug":"failed-to-create-file-w","errorCode":null,"errorMessage":"failed to create file: %w","messagePattern":"failed to create file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/auth/authentication/apikey/db_users.go","lineNumber":999,"sourceCode":"\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\treturn c.storeToFile()\n}\n\nfunc createStorage(filePath string) error {\n\tif err := os.MkdirAll(filepath.Dir(filePath), os.ModePerm); err != nil {\n\t\treturn fmt.Errorf(\"failed to create directories: %w\", err)\n\t}\n\n\t_, err := os.Stat(filePath)\n\tif err == nil { // file exists\n\t\treturn nil\n\t}\n\n\tif os.IsNotExist(err) {\n\t\tfile, err := os.Create(filePath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create file: %w\", err)\n\t\t}\n\t\tdefer file.Close()\n\t\treturn nil\n\t}\n\n\treturn err\n}\n\nfunc ReadFile(filename string) ([]byte, error) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tfileInfo, err := file.Stat()\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":981,"sourceCodeEnd":1017,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/auth/authentication/apikey/db_users.go#L981-L1017","documentation":"os.Create failed while creating the dynamic-users storage file during createStorage — the directory existed (or was created) but the file itself could not be created. Wrapped error has the OS cause: permission denied, name too long, or read-only filesystem. Only fires when the file does not already exist (existing files pass through).","triggerScenarios":"Thrown at usecases/auth/authentication/apikey/db_users.go:999 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify write permission on the directory for the db-users file name","Ensure the filename (from configuration) contains no invalid characters","Remount the filesystem read-write if read-only","Check disk space and inode availability"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}