{"record":{"id":"8d90e1ba4067cc5d","repo":"ipfs/kubo","slug":"cannot-use-both-allow-offline-and-allow-delega-8d90e1","errorCode":null,"errorMessage":"cannot use both --allow-offline and --allow-delegated flags","messagePattern":"cannot use both --allow-offline and --allow-delegated flags","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/name/publish.go","lineNumber":125,"sourceCode":"\t\tcmds.BoolOption(allowOfflineOptionName, \"Allow publishing when offline - publishes to local datastore without requiring network connectivity.\"),\n\t\tcmds.BoolOption(allowDelegatedOptionName, \"Allow publishing without DHT connectivity - uses local datastore and HTTP delegated publishers only.\"),\n\t\tcmds.Uint64Option(sequenceOptionName, \"Set a custom sequence number for the IPNS record (must be higher than current).\"),\n\t\tke.OptionIPNSBase,\n\t},\n\tRun: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tapi, err := cmdenv.GetApi(env, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallowOffline, _ := req.Options[allowOfflineOptionName].(bool)\n\t\tallowDelegated, _ := req.Options[allowDelegatedOptionName].(bool)\n\t\tcompatibleWithV1, _ := req.Options[v1compatOptionName].(bool)\n\t\tkname, _ := req.Options[keyOptionName].(string)\n\n\t\t// Validate flag combinations\n\t\tif allowOffline && allowDelegated {\n\t\t\treturn errors.New(\"cannot use both --allow-offline and --allow-delegated flags\")\n\t\t}\n\n\t\t// --lifetime and --ttl carry no client-side default, so the server can\n\t\t// tell whether the user set them explicitly; defaults are applied here.\n\t\tvalidTime := ipns.DefaultRecordLifetime\n\t\tif validTimeOpt, found := req.Options[lifeTimeOptionName].(string); found {\n\t\t\td, err := time.ParseDuration(validTimeOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing lifetime option: %s\", err)\n\t\t\t}\n\t\t\tif d <= 0 {\n\t\t\t\treturn fmt.Errorf(\"lifetime must be greater than zero, got %s\", validTimeOpt)\n\t\t\t}\n\t\t\tvalidTime = d\n\t\t}\n\n\t\topts := []options.NamePublishOption{\n\t\t\toptions.Name.AllowOffline(allowOffline),","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/name/publish.go#L107-L143","documentation":"Flag-combination guard in 'ipfs name publish': --allow-offline (local datastore only, no network) and --allow-delegated (local datastore plus HTTP delegated publishers) describe mutually exclusive publish modes and cannot both be set.","triggerScenarios":"Thrown at core/commands/name/publish.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep --allow-offline if you want a purely local publish with no outbound traffic","Keep --allow-delegated if you want the publish to reach configured delegated IPNS publishers","Drop both flags when online so the record goes to the DHT normally"],"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"}