ipfs/kubo · error · errFormat

format was set by multiple options. Only one format option…

Error message

format was set by multiple options. Only one format option is allowed

What it means

Sentinel errFormat from 'ipfs files stat': more than one output-shaping option (--format, --size/--hash shorthand flags) was supplied at once. The formatting choice is ambiguous, so the command refuses instead of picking a winner; exactly one format option is allowed.

Solutions

  1. Pass only one of --format, --hash, or --size
  2. Build the desired layout with a single --format template string
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/commands/files.go:165 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/ba5d47ede7a4dc71. Report an issue: GitHub.

Appendix: source

Thrown at core/commands/files.go:165

		"flush":  filesFlushCmd,
		"chcid":  filesChcidCmd,
		"chmod":  filesChmodCmd,
		"chroot": filesChrootCmd,
		"touch":  filesTouchCmd,
	},
}

const (
	filesCidVersionOptionName = "cid-version"
	filesHashOptionName       = "hash"
)

var (
	cidVersionOption = cmds.IntOption(filesCidVersionOptionName, "cid-ver", "Cid version to use. (experimental)")
	hashOption       = cmds.StringOption(filesHashOptionName, "Hash function to use. Will set Cid version to 1 if used. (experimental)")
)

var errFormat = errors.New("format was set by multiple options. Only one format option is allowed")

type statOutput struct {
	Hash           string
	Size           uint64
	CumulativeSize uint64
	Blocks         int
	Type           string
	WithLocality   bool   `json:",omitempty"`
	Local          bool   `json:",omitempty"`
	SizeLocal      uint64 `json:",omitempty"`
	Mode           uint32 `json:",omitempty"`
	Mtime          int64  `json:",omitempty"`
	MtimeNsecs     int    `json:",omitempty"`
}

func (s *statOutput) MarshalJSON() ([]byte, error) {
	type so statOutput
	out := &struct {

View on GitHub (pinned to 329838acdf)