{"record":{"id":"ff5f635510f4048d","repo":"ipfs/kubo","slug":"unknown-autonat-mode-d","errorCode":null,"errorMessage":"unknown autonat mode: %d","messagePattern":"unknown autonat mode: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/autonat.go","lineNumber":55,"sourceCode":"\t\t*m = AutoNATServiceEnabledV1Only\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown autonat mode: %s\", string(text))\n\t}\n\treturn nil\n}\n\nfunc (m AutoNATServiceMode) MarshalText() ([]byte, error) {\n\tswitch m {\n\tcase AutoNATServiceUnset:\n\t\treturn nil, nil\n\tcase AutoNATServiceEnabled:\n\t\treturn []byte(\"enabled\"), nil\n\tcase AutoNATServiceDisabled:\n\t\treturn []byte(\"disabled\"), nil\n\tcase AutoNATServiceEnabledV1Only:\n\t\treturn []byte(\"legacy-v1\"), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown autonat mode: %d\", m)\n\t}\n}\n\n// AutoNATConfig configures the node's AutoNAT subsystem.\ntype AutoNATConfig struct {\n\t// ServiceMode configures the node's AutoNAT service mode.\n\tServiceMode AutoNATServiceMode `json:\",omitempty\"`\n\n\t// Throttle configures AutoNAT dialback throttling.\n\t//\n\t// If unset, the conservative libp2p defaults will be unset. To help the\n\t// network, please consider setting this and increasing the limits.\n\t//\n\t// By default, the limits will be a total of 30 dialbacks, with a\n\t// per-peer max of 3 peer, resetting every minute.\n\tThrottle *AutoNATThrottleConfig `json:\",omitempty\"`\n}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/config/autonat.go#L37-L73","documentation":"AutoNATServiceMode.MarshalText hit its default arm: the in-memory enum value does not correspond to any known mode (unset, enabled, disabled, legacy-v1), so it has no textual representation for the config file. Almost always the result of a corrupted or programmatic value, not user input.","triggerScenarios":"Thrown at config/autonat.go:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set Swarm.AutoNATServiceMode in the config to one of the documented strings (enabled, disabled, legacy-v1)","Remove the key to let it take its default","Check for code that constructs AutoNATConfig with a raw numeric mode"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}