larksuite/cli · error
unsupported file provider mode %q
Error message
unsupported file provider mode %q
What it means
The file provider only supports the modes "singleValue" and "json" (with "" defaulting to "json"). Any other ProviderConfig.Mode string is rejected. This catches typos and unsupported provider dialects early instead of guessing a resolution strategy.
Source
Thrown at internal/binding/secret_resolve_file.go:103
var parsed interface{}
if err := json.Unmarshal(data, &parsed); err != nil {
return "", fmt.Errorf("file provider JSON parse error: %w", err)
}
value, err := ReadJSONPointer(parsed, ref.ID)
if err != nil {
return "", fmt.Errorf("file provider JSON Pointer %q: %w", ref.ID, err)
}
// Value must be a string
strValue, ok := value.(string)
if !ok {
return "", fmt.Errorf("file provider JSON Pointer %q resolved to non-string value", ref.ID)
}
return strValue, nil
default:
return "", fmt.Errorf("unsupported file provider mode %q", mode)
}
}
View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Set Mode to "json" (default) or "singleValue" — exact spelling matters.
- Remove the Mode field entirely to get the json default.
- If you need a new mode, extend the switch in resolveFileRef and its tests rather than passing an unknown value.
Example fix
// before mode: single-value // after mode: singleValue // or omit mode entirely for the json default
Defensive patterns
Strategy: validation
Validate before calling
switch pc.Mode {
case "", "json", "singleValue":
// ok
default:
return fmt.Errorf("file provider mode %q not supported; use json or singleValue", pc.Mode)
} Type guard
func validFileMode(m string) bool { return m == "" || m == "json" || m == "singleValue" } Try / catch
secret, err := resolveSecretRef(ctx, ref)
if err != nil {
if strings.Contains(err.Error(), "unsupported file provider mode") {
// correct the mode spelling in the provider config
}
return err
} Prevention
- Use only "json" (or omit) and "singleValue" — check exact spelling and camelCase.
- Add a config schema/enum check for Mode at load time.
- When porting config from other tools, map their mode names to this library's two supported modes.
When it happens
Trigger: Calling resolveSecretRef with a {source:"file"} SecretRef whose ProviderConfig.Mode is any string other than "singleValue", "json", or empty — e.g. "single-value", "raw", "yaml", or "text".
Common situations: Typo like "single_value" or "single-value"; copying config from another tool that supports more modes; IDE autocomplete inventing a mode name; older/newer config format drift.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- file provider path is empty
- singleValue file provider expects ref id %q, got %q
- file provider JSON Pointer %q: %w
- SecretRef.source must be env|file|exec, got %q
- SecretRef.id must be non-empty
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/d9e3d8ee0aaa7218.
Report an issue: GitHub.