larksuite/cli · error
%s is empty
Error message
%s is empty
What it means
proxyURL validates the fixed proxy address from LARKSUITE_CLI_PROXY_ADDRESS (or the config file). It rejects an address that is empty or whitespace-only; the message names the env var. This is fail-closed behavior: proxy-plugin mode is enabled but no usable proxy address was configured, so the CLI refuses to build the transport.
Source
Thrown at internal/transport/config.go:190
return false, nil
}
switch s {
case "1", "true", "on", "yes", "y":
return true, nil
case "0", "false", "off", "no", "n":
return false, nil
}
if b, err := strconv.ParseBool(s); err == nil {
return b, nil
}
return false, fmt.Errorf("invalid %s %q (want true/false/1/0)", name, raw)
}
// proxyURL validates the fixed configured proxy configuration and returns its URL.
func (c *Config) proxyURL() (*url.URL, error) {
raw := strings.TrimSpace(c.Proxy)
if raw == "" {
return nil, fmt.Errorf("%s is empty", envvars.CliProxyAddress)
}
redacted := redactProxyURL(raw)
u, err := url.Parse(raw)
if err != nil {
// Do not wrap the raw url.Parse error: its string embeds the original
// URL, which can contain userinfo (user:password). Return a redacted,
// generic message instead.
return nil, fmt.Errorf("invalid %s %q: malformed URL", envvars.CliProxyAddress, redacted)
}
if u.Scheme != "http" {
return nil, fmt.Errorf("invalid %s %q: scheme must be http", envvars.CliProxyAddress, redacted)
}
if u.Host == "" {
return nil, fmt.Errorf("invalid %s %q: missing host", envvars.CliProxyAddress, redacted)
}
// Security hardening: only allow a loopback proxy. This prevents accidental
// cross-machine proxying of credentials/traffic.
if u.Hostname() != "127.0.0.1" {View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Set a loopback proxy address with explicit port: `export LARKSUITE_CLI_PROXY_ADDRESS=http://127.0.0.1:8080`.
- If you don't have a proxy, disable plugin mode: `export LARKSUITE_CLI_PROXY_ENABLE=false` or unset it (and remove Enable:true from ~/.lark-cli/proxy_config.json).
- Check that the value isn't empty-with-whitespace: `echo "[$LARKSUITE_CLI_PROXY_ADDRESS]"`.
- In proxy_config.json, ensure both LARKSUITE_CLI_PROXY_ENABLE:true and a non-empty LARKSUITE_CLI_PROXY_ADDRESS are present together.
Example fix
// before export LARKSUITE_CLI_PROXY_ENABLE=true export LARKSUITE_CLI_PROXY_ADDRESS= // after export LARKSUITE_CLI_PROXY_ENABLE=true export LARKSUITE_CLI_PROXY_ADDRESS=http://127.0.0.1:8080
Defensive patterns
Strategy: validation
Validate before calling
if [ -n "$LARKSUITE_CLI_PROXY_ADDRESS" ]; then echo "address set: $LARKSUITE_CLI_PROXY_ADDRESS"; else echo 'LARKSUITE_CLI_PROXY_ADDRESS is empty but proxy mode may be enabled' >&2; fi
Prevention
- Never set LARKSUITE_CLI_PROXY_ENABLE=true without also setting a non-empty LARKSUITE_CLI_PROXY_ADDRESS.
- If you don't have a proxy, disable the plugin instead of leaving the address blank.
- Check provisioning scripts don't export the variable as empty.
- Keep Enable and Address together in proxy_config.json.
When it happens
Trigger: LARKSUITE_CLI_PROXY_ENABLE=true is set (or Enable:true in proxy_config.json) while LARKSUITE_CLI_PROXY_ADDRESS is unset, exported as an empty string (`export LARKSUITE_CLI_PROXY_ADDRESS=`), or contains only spaces; then ApplyToTransport runs during command startup.
Common situations: Enabling the proxy plugin but forgetting to set the address; a shell profile exporting the var empty; a provisioning tool clearing the variable; config file that sets Enable:true but omits LARKSUITE_CLI_PROXY_ADDRESS.
Understand the failure class
Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.
Related errors
- invalid %s %q (want true/false/1/0)
- invalid %s %q: malformed URL
- invalid %s %q: host must be 127.0.0.1
- invalid %s %q: explicit port is required
- invalid %s %q: path is not allowed
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/54a57fba81841cac.
Report an issue: GitHub.