router-for-me/CLIProxyAPI · warning
invalid field path: %s
Error message
invalid field path: %s
What it means
The dotted field path passed to setAuthFileMetadataValue contains an empty segment — a leading dot, trailing dot, double dot, or whitespace-only segment after trimming (e.g. ".weight", "a..b", "labels. "). The helper walks segments to nest maps and cannot address an unnamed key, so it rejects the path with the offending string included.
Source
Thrown at internal/api/handlers/management/auth_files_fields.go:354
if path == "" {
return ""
}
if idx := strings.Index(path, "."); idx >= 0 {
return strings.TrimSpace(path[:idx])
}
return path
}
func setAuthFileMetadataValue(metadata map[string]any, path string, value any) error {
if metadata == nil {
return fmt.Errorf("metadata is nil")
}
parts := strings.Split(path, ".")
current := metadata
for i, rawPart := range parts {
part := strings.TrimSpace(rawPart)
if part == "" {
return fmt.Errorf("invalid field path: %s", path)
}
if i == len(parts)-1 {
current[part] = value
return nil
}
next, ok := current[part].(map[string]any)
if !ok {
next = make(map[string]any)
current[part] = next
}
current = next
}
return nil
}
func applyAuthFileHeadersPatch(auth *coreauth.Auth, value any) {
if auth == nil {
returnView on GitHub (pinned to 78f0c4079e)
Solutions
- Look at the %s path echoed in the error and remove the stray dot or whitespace segment
- If building paths programmatically, filter out empty parts before joining with '.'
- Add client-side validation rejecting paths with empty segments
- Retry the PATCH with the corrected path
Example fix
// before
{"path": "providers..gemini", "value": 3}
// after
{"path": "providers.gemini", "value": 3} Defensive patterns
Strategy: validation
Validate before calling
for _, seg := range strings.Split(path, ".") {
if strings.TrimSpace(seg) == "" {
return fmt.Errorf("rejecting field path %q: empty segment", path)
}
} Type guard
func isValidFieldPath(path string) bool {
if strings.TrimSpace(path) == "" { return false }
for _, seg := range strings.Split(path, ".") {
if strings.TrimSpace(seg) == "" { return false }
}
return true
} Prevention
- Build dotted paths by joining only non-empty parts
- Client-side validate paths against a ^[\w-]+(\.[\w-]+)*$ style pattern
When it happens
Trigger: PATCHing an auth-file field whose request path string has a typo like "providers..gemini" or "weight."; client code building the path dynamically by joining empty parts with '.'; payloads where whitespace snuck into the key.
Common situations: Hand-written curl/PowerShell requests with dot typos; template strings interpolating an empty variable into the path; clients porting from a different nesting separator producing double dots.
Related errors
- weight is missing
- weight must be an integer
- count must be a positive integer
- Codex live multipart boundary is missing
- Codex live multipart body requires an sdp field
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/ccfc45f05874c2e6.
Report an issue: GitHub.