{"record":{"id":"f3dba3d0a5f2bd92","repo":"github/github-mcp-server","slug":"error-creating-file-v","errorCode":null,"errorMessage":"error creating file: %v","messagePattern":"error creating file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/translations/translations.go","lineNumber":63,"sourceCode":"\t\t\t\treturn value\n\t\t\t}\n\n\t\t\tv.SetDefault(key, defaultValue)\n\t\t\ttranslationKeyMap[key] = v.GetString(key)\n\t\t\treturn translationKeyMap[key]\n\t\t}, func() {\n\t\t\t// dump the translationKeyMap to a json file\n\t\t\tif err := DumpTranslationKeyMap(translationKeyMap); err != nil {\n\t\t\t\tlog.Fatalf(\"Could not dump translation key map: %v\", err)\n\t\t\t}\n\t\t}\n}\n\n// DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json\nfunc DumpTranslationKeyMap(translationKeyMap map[string]string) error {\n\tfile, err := os.Create(\"github-mcp-server-config.json\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating file: %v\", err)\n\t}\n\tdefer func() { _ = file.Close() }()\n\n\t// marshal the map to json\n\tjsonData, err := json.MarshalIndent(translationKeyMap, \"\", \"  \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshaling map to JSON: %v\", err)\n\t}\n\n\t// write the json data to the file\n\tif _, err := file.Write(jsonData); err != nil {\n\t\treturn fmt.Errorf(\"error writing to file: %v\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":45,"sourceCodeEnd":80,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/translations/translations.go#L45-L80","documentation":"DumpTranslationKeyMap cannot os.Create(\"github-mcp-server-config.json\") in the process working directory (the filename is hardcoded, relative to CWD). The dump is invoked by the cleanup function returned from translations.TranslationHelper(), which calls log.Fatalf on failure, terminating the process. Causes: read-only filesystem, permission denied, or a directory already occupying that path.","triggerScenarios":"Invoking the TranslationHelper cleanup/dump in a container with readOnlyRootFilesystem, a systemd unit with ProtectSystem=strict, or any CWD the process UID cannot write to.","commonSituations":"Kubernetes/Docker deployments with read-only root filesystems; running as non-root in a root-owned directory; CI runners in read-only workspaces.","solutions":["Run with a writable working directory (e.g. an emptyDir/ephemeral volume) if you depend on the dump","Do not invoke the dump cleanup in production - it exists to serialize the key map for translation customization","Remove any file or directory named github-mcp-server-config.json blocking creation in CWD","If the dump is required, chdir to a writable temp directory before calling it"],"exampleFix":"// before - fatal on read-only filesystems\n_, cleanup := translations.TranslationHelper()\ndefer cleanup() // log.Fatalf if CWD is not writable\n\n// after - only dump when CWD is writable\n_, cleanup := translations.TranslationHelper()\nif cwdWritable() {\n\tcleanup()\n}","handlingStrategy":"validation","validationCode":"func cwdWritable() bool {\n\tf, err := os.CreateTemp(\".\", \".writeprobe-*\")\n\tif err != nil {\n\t\treturn false\n\t}\n\t_ = f.Close()\n\t_ = os.Remove(f.Name())\n\treturn true\n}\nif cwdWritable() {\n\tcleanup() // dump translation key map\n} else {\n\tlog.Warn(\"skipping translation dump: working directory is not writable\")\n}","typeGuard":null,"tryCatchPattern":"if err := translations.DumpTranslationKeyMap(m); err != nil {\n\t// note: wrapped with %v, not %w - errors.Is/As cannot unwrap it; match the prefix only\n\tif strings.HasPrefix(err.Error(), \"error creating file\") {\n\t\t// CWD/permission problem: fix the directory, not the code\n\t}\n}","preventionTips":["Mount a writable volume and set it as workingDir in container specs","Only invoke the dump in interactive customization workflows, never at server shutdown","Remember the filename is hardcoded to CWD - the only lever is the working directory"],"tags":["go","filesystem","translations","containers","shutdown"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}