{"record":{"id":"d6dd80141650fe3c","repo":"ipfs/kubo","slug":"can-t-put-while-offline-pass-allow-offline-to","errorCode":null,"errorMessage":"can't put while offline: pass `--allow-offline` to store locally or `--allow-delegated` if Ipns.DelegatedPublishers are set up","messagePattern":"can't put while offline: pass `--allow-offline` to store locally or `--allow-delegated` if Ipns\\.DelegatedPublishers are set up","errorType":"exception","errorClass":"errPutAllowOffline","httpStatus":null,"severity":"error","filePath":"core/commands/name/name.go","lineNumber":340,"sourceCode":"\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tres.SetEncodingType(cmds.OctetStream)\n\t\tres.SetContentType(\"application/vnd.ipfs.ipns-record\")\n\t\treturn res.Emit(bytes.NewReader(data))\n\t},\n}\n\nconst (\n\tforceOptionName       = \"force\"\n\tputAllowOfflineOption = \"allow-offline\"\n\tallowDelegatedOption  = \"allow-delegated\"\n\tputQuietOptionName    = \"quiet\"\n\tmaxIPNSRecordSize     = 10 << 10 // 10 KiB per IPNS spec\n)\n\nvar errPutAllowOffline = errors.New(\"can't put while offline: pass `--allow-offline` to store locally or `--allow-delegated` if Ipns.DelegatedPublishers are set up\")\n\nvar IpnsPutCmd = &cmds.Command{\n\tStatus: cmds.Experimental,\n\tHelptext: cmds.HelpText{\n\t\tTagline: \"Store a pre-signed IPNS record in the routing system.\",\n\t\tShortDescription: `\nStores a pre-signed IPNS record in the routing system.\n\nThis command accepts a raw IPNS record (protobuf) as defined in the IPNS spec:\nhttps://specs.ipfs.tech/ipns/ipns-record/\n\nThe record must be signed by the private key corresponding to the IPNS name.\nUse 'ipfs name get' to retrieve records and 'ipfs name inspect' to examine.\n`,\n\t\tLongDescription: `\nStores a pre-signed IPNS record in the routing system.\n\nThis command accepts a raw IPNS record (protobuf) as defined in the IPNS spec:","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/name/name.go#L322-L358","documentation":"errPutAllowOffline is returned by `ipfs ipns put` when the node is offline and neither --allow-offline nor --allow-delegated was passed. IPNS record publishing normally requires network access to the routing system; this error tells the user which opt-in flag to use for local-only storage or delegated HTTP publishing. Note: at core/commands/name/name.go:538 an older bare \"can't put while offline\" error is remapped to this richer message.","triggerScenarios":"Running `ipfs ipns put` (or a code path that publishes an IPNS record) while the daemon cannot reach the routing system / network, without --allow-offline or --allow-delegated.","commonSituations":"Daemon started with Offline mode or in a sandbox/CI without network; publishing a pre-signed record while connectivity is down; tests running against an offline node.","solutions":["Re-run with --allow-offline to store the record locally only","Re-run with --allow-delegated if Ipns.DelegatedPublishers are configured for HTTP publishing","Bring the node online (check network/connectivity, routing config) and retry"],"exampleFix":"// before\nipfs ipns put --key=self record.bin\n// error: can't put while offline: pass `--allow-offline` ...\n// after\nipfs ipns put --allow-offline --key=self record.bin","handlingStrategy":"try-catch","validationCode":"// check offline state / connectivity before publishing\ncfg, _ := node.Repo.Config()\n// or simply always pass an explicit mode flag in automation","typeGuard":null,"tryCatchPattern":"err := ipnsPut(ctx, rec)\nif err != nil && strings.Contains(err.Error(), \"can't put while offline\") {\n    // decide: retry with --allow-offline, or wait for connectivity\n}","preventionTips":["Pass --allow-offline or --allow-delegated explicitly in scripts","Check daemon connectivity before publish operations"],"tags":["ipns","offline","publishing"],"backgroundTag":"publish-while-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"}