larksuite/cli · error

sheets: no flag-defs.json entry for %q

Error message

sheets: no flag-defs.json entry for %q

What it means

flagsFor panics when the compiled flag-defs table has no entry for the requested sheets command - a missing entry means the command's flag surface was never generated, and a silent empty flag set would be worse.

Source

Thrown at shortcuts/sheets/flag_defs.go:63

// The error return is always nil; it is retained so existing call sites that
// handled a parse error keep compiling. There is no longer a runtime parse.
func loadFlagDefs() (map[string]commandDef, error) {
	return flagDefs, nil
}

// flagsFor builds the []common.Flag for a shortcut command directly from
// flag-defs.json. System-kind flags are skipped (the framework injects
// them). Panics if the command is absent or the JSON is malformed — this
// is a build-time data contract, so a missing entry is a programming error
// surfaced loudly at startup rather than a silent empty flag set.
func flagsFor(command string) []common.Flag {
	defs, err := loadFlagDefs()
	if err != nil {
		panic(fmt.Sprintf("sheets: %v", err))
	}
	spec, ok := defs[command]
	if !ok {
		panic(fmt.Sprintf("sheets: no flag-defs.json entry for %q", command))
	}
	out := make([]common.Flag, 0, len(spec.Flags))
	for _, df := range spec.Flags {
		if df.Kind == "system" {
			continue
		}
		out = append(out, common.Flag{
			Name:     df.Name,
			Type:     df.Type,
			Default:  df.Default,
			Desc:     df.Desc,
			Hidden:   df.Hidden,
			Required: df.Required == "required",
			Enum:     df.Enum,
			Input:    df.Input,
		})
	}
	return out

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Regenerate flag-defs.json/flag_defs_gen.go so it includes the command, or fix the command key
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/sheets/flag_defs.go:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/3fd757ee1766aa11. Report an issue: GitHub.