{"record":{"id":"871b537ebcd84a2e","repo":"ipfs/kubo","slug":"this-action-must-be-run-in-online-mode-try-runnin","errorCode":null,"errorMessage":"this action must be run in online mode, try running 'ipfs daemon' first","messagePattern":"this action must be run in online mode, try running 'ipfs daemon' first","errorType":"exception","errorClass":"ErrOffline","httpStatus":null,"severity":"error","filePath":"core/coreiface/errors.go","lineNumber":8,"sourceCode":"package iface\n\nimport \"errors\"\n\nvar (\n\tErrIsDir        = errors.New(\"this dag node is a directory\")\n\tErrNotFile      = errors.New(\"this dag node is not a regular file\")\n\tErrOffline      = errors.New(\"this action must be run in online mode, try running 'ipfs daemon' first\")\n\tErrNotSupported = errors.New(\"operation not supported\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":11,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreiface/errors.go#L1-L11","documentation":"`iface.ErrOffline` is a sentinel error returned when an operation requires network connectivity but the node is running offline (no daemon or daemon with libp2p disabled). IPNS publishing, routing put, swarm connect/disconnect, and path resolution against DNS/IPNS all need online mode, so CoreAPI implementations return this sentinel so callers can map it to a friendlier message (kubo's CLI converts it to errAllowOffline when --offline semantics allow).","triggerScenarios":"Calling `api.Name().Publish`, `api.Routing().Put`, `api.Swarm().Connect/Disconnect`, `api.Swarm().KnownAddrs`, or `api.Name().Resolve` while the node is offline: either no `ipfs daemon` is running (offline CLI commands like `ipfs name publish` without a daemon) or the daemon runs with routing disabled/no libp2p host.","commonSituations":"Running `ipfs name publish` without a daemon (users often hit this and need `--offline` or must start the daemon); scripts that assumed a local API was online but the daemon crashed; nodes configured with `Routing.Type=none` trying routing operations; CI environments that forgot to start the daemon.","solutions":["Start the daemon (`ipfs daemon`) so the node is online, then retry the operation.","If the operation is intentionally offline (e.g. IPNS publish with an offline private key), use the offline-capable path: `ipfs name publish --offline` (kubo maps ErrOffline to errAllowOffline for commands that support it).","In code, detect it with `errors.Is(err, iface.ErrOffline)` and either surface the 'run ipfs daemon first' hint or fall back to an offline variant of the operation."],"exampleFix":"// before\nname, err := api.Name().Publish(ctx, p)\nif err != nil { return err }\n// after\nname, err := api.Name().Publish(ctx, p)\nif err != nil {\n    if errors.Is(err, iface.ErrOffline) {\n        return cmdErrAllowOffline // or prompt user to start daemon\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// Before IPNS publish / routing put, confirm the node is online:\n// 1) an ipfs daemon is running and API reachable: `ipfs id`\n// 2) Routing.Type is not 'none' for routing operations","typeGuard":null,"tryCatchPattern":"err := api.Name().Publish(ctx, p)\nif err != nil {\n    if errors.Is(err, iface.ErrOffline) {\n        // either start the daemon or take the offline-capable path\n        return publishOffline(ctx, p) // e.g. `ipfs name publish --offline`\n    }\n    return err\n}","preventionTips":["Always start `ipfs daemon` before network-dependent commands in scripts and CI","Use `--offline` flags for operations intentionally done without a daemon","Detect with errors.Is(err, iface.ErrOffline) rather than string matching","Monitor daemon liveness before issuing online-mode API calls"],"tags":["offline","coreapi","ipns","sentinel-error","daemon"],"backgroundTag":"node-offline","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"}