{"record":{"id":"d9bc0a460f37f997","repo":"ipfs/kubo","slug":"s-implies-offline-and-cannot-be-combined-with","errorCode":null,"errorMessage":"--%s implies --offline and cannot be combined with --offline=false; please drop one of them","messagePattern":"--(.+?) implies --offline and cannot be combined with --offline=false; please drop one of them","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/dag/export.go","lineNumber":46,"sourceCode":"// pb/v3 template for `ipfs dag export`: byte counter, speed, and\n// elapsed time. No bar/percent/ETA because the total size of the\n// CAR stream is not known up front. The explicit \"%s/s\" speed\n// format overrides pb's default \"p/s\" suffix so the rate renders\n// as \"MiB/s\".\nconst progressBarTemplate = `{{counters . }} {{speed . \"%s/s\" \"?/s\"}} {{etime . }}`\n\nfunc dagExport(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t// Accept CID or a content path\n\tp, err := cmdutils.PathOrCidPath(req.Arguments[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlocalOnly, _ := req.Options[localOnlyOptionName].(bool)\n\tif localOnly {\n\t\t// --local-only and --offline=false contradict each other.\n\t\tif offline, set := req.Options[\"offline\"].(bool); set && !offline {\n\t\t\treturn fmt.Errorf(\"--%s implies --offline and cannot be combined with --offline=false; please drop one of them\", localOnlyOptionName)\n\t\t}\n\t}\n\n\tapi, err := cmdenv.GetApi(env, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif localOnly {\n\t\t// --local-only implies --offline so api.Block().Stat below cannot\n\t\t// reach out for path resolution. The DAG walk itself uses the raw\n\t\t// blockstore via walker (see exportPartialCAR) and is local by\n\t\t// construction regardless of this setting.\n\t\tapi, err = api.WithOptions(options.Api.Offline(true))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/dag/export.go#L28-L64","documentation":"The `ipfs dag export` command returns this when the user passes `--local-only` together with an explicit `--offline=false`. `--local-only` means the export must be served purely from the local blockstore, which necessarily implies offline behavior, so the two flags are logically contradictory. The command fails fast before any API call is made rather than guessing which flag wins.","triggerScenarios":"Running `ipfs dag export --local-only --offline=false <cid>` (or scripting that sets localOnlyOptionName=true while leaving a leftover offline=false option). The check fires only when `offline` was explicitly set to false; omitting `--offline` entirely is fine because local-only then implies offline silently.","commonSituations":"Shell aliases or wrapper scripts that always append `--offline=false`; combining an old documented invocation with a new `--local-only` flag; CI scripts templated with both options for flexibility.","solutions":["Drop `--offline=false` from the command line; `--local-only` already implies offline behavior.","If you truly want online fetching, remove `--local-only` instead and keep the node online.","Fix any wrapper script/alias that injects `--offline=false` unconditionally."],"exampleFix":"// before\nipfs dag export --local-only --offline=false bafy... > out.car\n\n// after\nipfs dag export --local-only bafy... > out.car","handlingStrategy":"validation","validationCode":"if local_only and not offline:\n    raise ValueError(\"--local-only implies --offline; drop --offline=false\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not set --offline=false in wrapper scripts that also use --local-only.","Omit the --offline flag entirely when using --local-only.","Parse command output before running long exports to catch flag conflicts early."],"tags":["cli","flags-conflict","dag-export"],"backgroundTag":"conflicting-cli-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"}