router-for-me/CLIProxyAPI · warning

auth path is empty

Error message

auth path is empty

What it means

deleteTokenRecord was called with a path that is empty after trimming. The handler refuses rather than calling store.Delete with a blank path, which could resolve to the wrong record depending on the store backend. This is a caller or record-shape problem: the auth being deleted has no file path attribute.

Source

Thrown at internal/api/handlers/management/auth_files_fields.go:672

		return strings.EqualFold(left, right)
	}
	return left == right
}

func cleanAuthFilePath(path string) string {
	path = strings.TrimSpace(path)
	if path == "" {
		return ""
	}
	if abs, errAbs := filepath.Abs(path); errAbs == nil && strings.TrimSpace(abs) != "" {
		path = abs
	}
	return filepath.Clean(path)
}

func (h *Handler) deleteTokenRecord(ctx context.Context, path string) error {
	if strings.TrimSpace(path) == "" {
		return fmt.Errorf("auth path is empty")
	}
	store := h.tokenStoreWithBaseDir()
	if store == nil {
		return fmt.Errorf("token store unavailable")
	}
	return store.Delete(ctx, path)
}

func (h *Handler) tokenStoreWithBaseDir() coreauth.Store {
	if h == nil {
		return nil
	}
	store := h.tokenStore
	if store == nil {
		store = sdkAuth.GetTokenStore()
		h.tokenStore = store
	}
	if h.cfg != nil {

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. GET the auth record and inspect its attributes to see whether a path is expected
  2. If the record is file-backed, repair or regenerate it so the path attribute is populated, then retry the delete
  3. If it is intentionally file-less, remove it via the store's own delete endpoint rather than the file-based path
  4. Audit custom code that creates auth records without setting the path attribute
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(path) == "" {
    return errors.New("cannot delete token record: auth has no file path")
}

Type guard

func authHasFilePath(auth *coreauth.Auth) bool {
    return auth != nil && strings.TrimSpace(authAttribute(auth, "path")) != ""
}

Prevention

When it happens

Trigger: DELETE of an auth record whose "path" attribute is missing or blank (record from an external store or a custom synthesizer); internal calls passing an untrimmed empty string.

Common situations: Deleting credentials created programmatically without a backing file; attribute stripping when records round-trip through Postgres/git/object stores; test fixtures with minimal records.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/599ffb2f6a5ad0ee. Report an issue: GitHub.