larksuite/cli · error
sheets: %v
Error message
sheets: %v
What it means
Compatibility error return of loadFlagDefs: it always returns nil because flag definitions are compile-time generated (flag_defs_gen.go) and no runtime parsing exists; the error slot is retained only so legacy call sites keep compiling.
Source
Thrown at shortcuts/sheets/flag_defs.go:59
Flags []flagDef `json:"flags"`
}
// loadFlagDefs returns the compiled flag definitions (flag_defs_gen.go).
// 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,View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Regenerate flag_defs_gen.go; report if the compiled-in defs are malformed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shortcuts/sheets/flag_defs.go:59 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/a5b88111562c92e3.
Report an issue: GitHub.