{"record":{"id":"510bc58d4c91aa76","repo":"AlexxIT/go2rtc","slug":"config-file-disabled","errorCode":null,"errorMessage":"config file disabled","messagePattern":"config file disabled","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/app/config.go","lineNumber":26,"sourceCode":"\t\"sync\"\n\n\t\"github.com/AlexxIT/go2rtc/pkg/creds\"\n\t\"github.com/AlexxIT/go2rtc/pkg/yaml\"\n)\n\nfunc LoadConfig(v any) {\n\tfor _, data := range configs {\n\t\tif err := yaml.Unmarshal(data, v); err != nil {\n\t\t\tLogger.Warn().Err(err).Send()\n\t\t}\n\t}\n}\n\nvar configMu sync.Mutex\n\nfunc PatchConfig(path []string, value any) error {\n\tif ConfigPath == \"\" {\n\t\treturn errors.New(\"config file disabled\")\n\t}\n\n\tconfigMu.Lock()\n\tdefer configMu.Unlock()\n\n\t// empty config is OK\n\tb, _ := os.ReadFile(ConfigPath)\n\n\tb, err := yaml.Patch(b, path, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn os.WriteFile(ConfigPath, b, 0644)\n}\n\ntype flagConfig []string\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/app/config.go#L8-L44","documentation":"PatchConfig persists a change to the YAML config file, but go2rtc was started without a config file path (ConfigPath == \"\"), e.g. running with no -config flag and no config file discovered. Since there is no file to write to, all config patching (API /api PATCH calls, stream pairing, etc.) is disabled. The library refuses the operation rather than silently discarding changes.","triggerScenarios":"Any call to PatchConfig or an API endpoint that patches config (SetValue, apiPair, apiUnpair, apiStreams, apiPreload) when the process was launched without a config file.","commonSituations":"Running go2rtc with environment variables only or defaults instead of a config file; calling the HTTP API (POST/PATCH to /api/streams etc.) on an instance started without -config; Docker images without a mounted go2rtc.yaml.","solutions":["Start go2rtc with a config file: pass -config /path/to/go2rtc.yaml (or place go2rtc.yaml in the working directory) so ConfigPath is set","If config is intentionally disabled, stop using config-patching APIs and manage configuration via startup config/env instead","Verify ConfigPath is non-empty at runtime before calling the patching APIs"],"exampleFix":"// before\nexec: go2rtc (no config)\n// after\nexec: go2rtc -config /etc/go2rtc/go2rtc.yaml","handlingStrategy":"validation","validationCode":"if app.ConfigPath == \"\" { return errors.New(\"config patching requires a config file; start with -config\") }","typeGuard":null,"tryCatchPattern":"if err := app.PatchConfig(path, value); err != nil { if err.Error() == \"config file disabled\" { /* fall back to in-memory config */ } }","preventionTips":["Always launch go2rtc with an explicit -config path when using the PATCH/pair APIs","Check ConfigPath before enabling config-writing UI features","Mount a writable go2rtc.yaml in container deployments"],"tags":["config","go2rtc","configuration-disabled"],"backgroundTag":"missing-config-file","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}