router-for-me/CLIProxyAPI · error

unsupported plugin store auth type %q

Error message

unsupported plugin store auth type %q

What it means

The env-based plugin store auth switch hit a default case: item.Type is not one of "", none, bearer, basic, header, github-token. The message embeds the offending value verbatim, so typos are easy to spot.

Source

Thrown at internal/pluginstore/auth.go:269

		encoded := base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
		headers.Set("Authorization", "Basic "+encoded)
	case AuthTypeHeader:
		if strings.TrimSpace(item.HeaderName) == "" {
			return false, fmt.Errorf("plugin store auth missing header-name")
		}
		value, errValue := envValueRequired(item.HeaderValueEnv, "header-value-env")
		if errValue != nil {
			return false, errValue
		}
		headers.Set(item.HeaderName, value)
	case AuthTypeGitHubToken:
		token, errToken := envValueRequired(item.TokenEnv, "token-env")
		if errToken != nil {
			return false, errToken
		}
		headers.Set("Authorization", "Bearer "+token)
	default:
		return false, fmt.Errorf("unsupported plugin store auth type %q", item.Type)
	}
	return true, nil
}

func applyResolvedPluginStoreAuth(headers http.Header, item ResolvedAuthConfig) (bool, error) {
	switch strings.ToLower(strings.TrimSpace(item.Type)) {
	case "", AuthTypeNone:
		return false, nil
	case AuthTypeBearer, AuthTypeGitHubToken:
		if len(item.Token) == 0 {
			return false, fmt.Errorf("plugin store resolved auth token is empty")
		}
		headers.Set("Authorization", "Bearer "+string(item.Token))
	case AuthTypeBasic:
		if len(item.Username) == 0 || len(item.Password) == 0 {
			return false, fmt.Errorf("plugin store resolved basic auth is incomplete")
		}
		credential := make([]byte, 0, len(item.Username)+1+len(item.Password))

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Set auth.type to one of: none, bearer, basic, header, github-token (or omit it for none)
  2. After upgrading, re-check the store config against the current config.example.yaml for renamed types

Example fix

# before
auth:
  type: token
  token-env: GITHUB_TOKEN

# after
auth:
  type: github-token
  token-env: GITHUB_TOKEN
Defensive patterns

Strategy: validation

Validate before calling

var validAuthTypes = map[string]bool{"": true, "none": true, "bearer": true, "basic": true, "header": true, "github-token": true}

func validAuthType(t string) bool {
    return validAuthTypes[strings.ToLower(strings.TrimSpace(t))]
}

Prevention

When it happens

Trigger: auth.type set to a misspelled or renamed value (e.g. "token", "githubtoken", "ApiKey", trailing whitespace is trimmed but casing of unknown words is not corrected).

Common situations: Copy-pasted config from other tools using different auth type names; store schema changes between versions introducing a type the running binary does not know.

Related errors


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