{"record":{"id":"53bf1621ffa88b41","repo":"juanfont/headscale","slug":"dumping-config-w","errorCode":null,"errorMessage":"dumping config: %w","messagePattern":"dumping config: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/headscale/cli/dump_config.go","lineNumber":21,"sourceCode":"import (\n\t\"fmt\"\n\n\t\"github.com/spf13/cobra\"\n\t\"github.com/spf13/viper\"\n)\n\nfunc init() {\n\trootCmd.AddCommand(dumpConfigCmd)\n}\n\nvar dumpConfigCmd = &cobra.Command{\n\tUse:    \"dumpConfig\",\n\tShort:  \"dump current config to /etc/headscale/config.dump.yaml, integration test only\",\n\tHidden: true,\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\terr := viper.WriteConfigAs(\"/etc/headscale/config.dump.yaml\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"dumping config: %w\", err)\n\t\t}\n\n\t\treturn nil\n\t},\n}\n","sourceCodeStart":3,"sourceCodeEnd":27,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/dump_config.go#L3-L27","documentation":"Error from the hidden 'headscale dumpConfig' command when viper.WriteConfigAs fails to write the merged configuration to /etc/headscale/config.dump.yaml. This command is integration-test only; failure is almost always filesystem-related (missing directory or no write permission).","triggerScenarios":"Running dumpConfig in an environment where /etc/headscale does not exist or the process lacks write permission to it (non-root user, read-only container filesystem, missing volume mount in the integration container).","commonSituations":"Integration Docker image where /etc/headscale is mounted read-only or absent; running the hidden command manually on a workstation without root; disk-full conditions in CI.","solutions":["Create /etc/headscale and ensure the running user can write to it, or run as the user that owns it","In integration environments, confirm the config volume is mounted writable","If exploring config locally, prefer copying config to a writable path and adjust the command/test instead"],"exampleFix":"# before (read-only /etc/headscale)\nheadscale dumpConfig\n\n# after\nsudo mkdir -p /etc/headscale && sudo chown $(id -u) /etc/headscale\nheadscale dumpConfig","handlingStrategy":"validation","validationCode":"if err := os.MkdirAll(\"/etc/headscale\", 0o755); err != nil {\n\treturn err\n}\nif f, err := os.Create(\"/etc/headscale/.write_test\"); err != nil {\n\treturn fmt.Errorf(\"no write access to /etc/headscale: %w\", err)\n} else { f.Close(); os.Remove(f.Name()) }","typeGuard":null,"tryCatchPattern":"if err := viper.WriteConfigAs(path); err != nil {\n\treturn fmt.Errorf(\"dumping config to %s: %w\", path, err)\n}","preventionTips":["Mount integration config volumes writable","Prefer generating dumps to a temp dir when running manually"],"tags":["filesystem","configuration","integration-test","go"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}