{"record":{"id":"ad5ace0d9eb8882b","repo":"ipfs/kubo","slug":"cannot-use-both-allow-offline-and-allow-delega","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/name.go","lineNumber":446,"sourceCode":"\tRun: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tnd, err := cmdenv.GetNode(env)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tapi, err := cmdenv.GetApi(env, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Parse options\n\t\tforce, _ := req.Options[forceOptionName].(bool)\n\t\tallowOffline, _ := req.Options[putAllowOfflineOption].(bool)\n\t\tallowDelegated, _ := req.Options[allowDelegatedOption].(bool)\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// Handle different publishing modes\n\t\tif allowDelegated {\n\t\t\t// AllowDelegated mode: check if delegated publishers are configured\n\t\t\tcfg, err := nd.Repo.Config()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to read config: %w\", err)\n\t\t\t}\n\t\t\tdelegatedPublishers := cfg.DelegatedPublishersWithAutoConf()\n\t\t\tif len(delegatedPublishers) == 0 {\n\t\t\t\treturn errors.New(\"no delegated publishers configured: add Ipns.DelegatedPublishers or use --allow-offline for local-only publishing\")\n\t\t\t}\n\t\t\t// For allow-delegated mode, we proceed even if offline\n\t\t\t// since we're using HTTP publishing via delegated publishers\n\t\t}\n\n\t\t// Parse the IPNS name argument","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/name/name.go#L428-L464","documentation":"`ipfs ipns put` treats --allow-offline and --allow-delegated as mutually exclusive publishing modes: local-only storage versus HTTP publishing via delegated publishers. Passing both is rejected outright before any publishing happens.","triggerScenarios":"Invoking `ipfs ipns put --allow-offline --allow-delegated ...` with both boolean flags set.","commonSituations":"Scripts accumulating flags from config where both modes were enabled, or users unsure which mode applies and passing both 'to be safe'.","solutions":["Choose one mode: use --allow-offline for local-only publishing, or --allow-delegated for delegated publishers","Remove one of the two flags from the invoking script/profile"],"exampleFix":"// before\nipfs ipns put --allow-offline --allow-delegated --key=self record.bin\n// error: cannot use both --allow-offline and --allow-delegated flags\n// after\nipfs ipns put --allow-delegated --key=self record.bin","handlingStrategy":"validation","validationCode":"if allowOffline && allowDelegated {\n    return errors.New(\"choose either --allow-offline or --allow-delegated, not both\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never build flag sets from config that could contain both modes","Pick one publishing mode per script/environment"],"tags":["ipns","cli","flag-validation"],"backgroundTag":"mutually-exclusive-flags","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"}