larksuite/cli · error
invalid value %q for --%s, allowed: %s
Error message
invalid value %q for --%s, allowed: %s
What it means
Enum normalization for batch ops: the string value is not in the embedded flag-defs enum, not a case-insensitive canonical match, and not a retired value (which would be dropped as if omitted); the message may append a closest-match suggestion.
Source
Thrown at shortcuts/sheets/flag_view.go:364
}
if value == "" || slices.Contains(df.Enum, value) {
continue
}
if canonical := canonicalEnumValue(value, df.Enum); canonical != "" {
m.raw[rawKey] = canonical
continue
}
// A retired value means "as if omitted" — delete the key so Changed()
// also reports it as absent, matching the standalone path.
if isRetiredEnumValue(m.command, df.Name, value) {
delete(m.raw, rawKey)
continue
}
message := fmt.Sprintf("invalid value %q for --%s, allowed: %s", value, df.Name, strings.Join(df.Enum, ", "))
if match := closestEnumValue(value, df.Enum); match != "" {
message += fmt.Sprintf("; did you mean %q?", match)
}
return fmt.Errorf("%s", message) //nolint:forbidigo // intermediate error; batch dispatcher adds typed operations context
}
return nil
}
// normalizeRangeSheetPrefix mirrors the standalone chainRangeSheetPrefix
// rewrite (range_sheet_prefix.go) for the map-backed paths, +batch-update
// sub-ops and +cells-set --writes items: one that named its sheet only inside
// "range" ("Sheet1!A1:D20") gets sheet_name filled in and the bare range left
// behind, so every form accepts the same input.
//
// The derived selector is written under the underscore key the sub-op input
// vocabulary uses, and left as the only spelling of it; lookupRaw is
// separator-tolerant, so a translator asking for "sheet-name" finds it anyway.
func (m *mapFlagView) normalizeRangeSheetPrefix() {
if !rangeSheetPrefixApplies(m.command) {
return
}
if strings.TrimSpace(m.Str("sheet-id")) != "" || strings.TrimSpace(m.Str("sheet-name")) != "" {View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Use one of the allowed enum values listed in the message, or the suggested closest match
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shortcuts/sheets/flag_view.go:364 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/27061f5ff47d2539.
Report an issue: GitHub.