github/github-mcp-server · error
error creating file: %v
Error message
error creating file: %v
What it means
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.
Source
Thrown at pkg/translations/translations.go:63
return value
}
v.SetDefault(key, defaultValue)
translationKeyMap[key] = v.GetString(key)
return translationKeyMap[key]
}, func() {
// dump the translationKeyMap to a json file
if err := DumpTranslationKeyMap(translationKeyMap); err != nil {
log.Fatalf("Could not dump translation key map: %v", err)
}
}
}
// DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json
func DumpTranslationKeyMap(translationKeyMap map[string]string) error {
file, err := os.Create("github-mcp-server-config.json")
if err != nil {
return fmt.Errorf("error creating file: %v", err)
}
defer func() { _ = file.Close() }()
// marshal the map to json
jsonData, err := json.MarshalIndent(translationKeyMap, "", " ")
if err != nil {
return fmt.Errorf("error marshaling map to JSON: %v", err)
}
// write the json data to the file
if _, err := file.Write(jsonData); err != nil {
return fmt.Errorf("error writing to file: %v", err)
}
return nil
}
View on GitHub (pinned to 0ea1f775a7)
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
Example fix
// before - fatal on read-only filesystems
_, cleanup := translations.TranslationHelper()
defer cleanup() // log.Fatalf if CWD is not writable
// after - only dump when CWD is writable
_, cleanup := translations.TranslationHelper()
if cwdWritable() {
cleanup()
} Defensive patterns
Strategy: validation
Validate before calling
func cwdWritable() bool {
f, err := os.CreateTemp(".", ".writeprobe-*")
if err != nil {
return false
}
_ = f.Close()
_ = os.Remove(f.Name())
return true
}
if cwdWritable() {
cleanup() // dump translation key map
} else {
log.Warn("skipping translation dump: working directory is not writable")
} Try / catch
if err := translations.DumpTranslationKeyMap(m); err != nil {
// note: wrapped with %v, not %w - errors.Is/As cannot unwrap it; match the prefix only
if strings.HasPrefix(err.Error(), "error creating file") {
// CWD/permission problem: fix the directory, not the code
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Kubernetes/Docker deployments with read-only root filesystems; running as non-root in a root-owned directory; CI runners in read-only workspaces.
Related errors
- error writing to file: %v
- GitHub App authentication and GITHUB_PERSONAL_ACCESS_TOKEN a
- GitHub App authentication and OAuth login (--oauth-client-id
- GitHub App authentication requires a private key: set GITHUB
- GitHub App ID or client ID is required (GITHUB_APP_ID)
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/f3dba3d0a5f2bd92.
Report an issue: GitHub.