ipfs/kubo · error
cannot use both --allow-offline and --allow-delegated flags
Error message
cannot use both --allow-offline and --allow-delegated flags
What it means
`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.
Source
Thrown at core/commands/name/name.go:446
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
nd, err := cmdenv.GetNode(env)
if err != nil {
return err
}
api, err := cmdenv.GetApi(env, req)
if err != nil {
return err
}
// Parse options
force, _ := req.Options[forceOptionName].(bool)
allowOffline, _ := req.Options[putAllowOfflineOption].(bool)
allowDelegated, _ := req.Options[allowDelegatedOption].(bool)
// Validate flag combinations
if allowOffline && allowDelegated {
return errors.New("cannot use both --allow-offline and --allow-delegated flags")
}
// Handle different publishing modes
if allowDelegated {
// AllowDelegated mode: check if delegated publishers are configured
cfg, err := nd.Repo.Config()
if err != nil {
return fmt.Errorf("failed to read config: %w", err)
}
delegatedPublishers := cfg.DelegatedPublishersWithAutoConf()
if len(delegatedPublishers) == 0 {
return errors.New("no delegated publishers configured: add Ipns.DelegatedPublishers or use --allow-offline for local-only publishing")
}
// For allow-delegated mode, we proceed even if offline
// since we're using HTTP publishing via delegated publishers
}
// Parse the IPNS name argumentView on GitHub (pinned to 329838acdf)
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
Example fix
// before ipfs ipns put --allow-offline --allow-delegated --key=self record.bin // error: cannot use both --allow-offline and --allow-delegated flags // after ipfs ipns put --allow-delegated --key=self record.bin
Defensive patterns
Strategy: validation
Validate before calling
if allowOffline && allowDelegated {
return errors.New("choose either --allow-offline or --allow-delegated, not both")
} Prevention
- Never build flag sets from config that could contain both modes
- Pick one publishing mode per script/environment
When it happens
Trigger: Invoking `ipfs ipns put --allow-offline --allow-delegated ...` with both boolean flags set.
Common situations: Scripts accumulating flags from config where both modes were enabled, or users unsure which mode applies and passing both 'to be safe'.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- cannot import key with name 'self'
- DHT timeout value must be >= 0
- ttl (%s) must not be greater than lifetime (%s)
- can't combine --all with other matching options
- the --verbose and --quiet options can not be used at the sam
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/ad5ace0d9eb8882b.
Report an issue: GitHub.