router-for-me/CLIProxyAPI · error

plugin store auth missing header-name

Error message

plugin store auth missing header-name

What it means

When a plugin store's auth config declares type "header", the config must also provide header-name; the env-based auth applier rejects the config otherwise. The env var supplying the header value (header-value-env) is only read after this check, so the error is purely a config-completeness failure.

Source

Thrown at internal/pluginstore/auth.go:255

		token, errToken := envValueRequired(item.TokenEnv, "token-env")
		if errToken != nil {
			return false, errToken
		}
		headers.Set("Authorization", "Bearer "+token)
	case AuthTypeBasic:
		username, errUsername := envValueRequired(item.UsernameEnv, "username-env")
		if errUsername != nil {
			return false, errUsername
		}
		password, errPassword := envValueRequired(item.PasswordEnv, "password-env")
		if errPassword != nil {
			return false, errPassword
		}
		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
}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Add header-name to the store's auth block in the plugin store config
  2. Validate the store config with a schema/lint step before deploying
  3. Check for YAML indentation errors that silently detach header-name from the auth map

Example fix

# before
auth:
  type: header
  header-value-env: MY_HEADER

# after
auth:
  type: header
  header-name: X-Custom-Token
  header-value-env: MY_HEADER
Defensive patterns

Strategy: validation

Validate before calling

func validateStoreAuth(item StoreAuthConfig) error {
    switch strings.ToLower(strings.TrimSpace(item.Type)) {
    case "", "none":
        return nil
    case "header":
        if strings.TrimSpace(item.HeaderName) == "" {
            return fmt.Errorf("auth.type 'header' requires auth.header-name")
        }
    }
    return nil
}

Prevention

When it happens

Trigger: A plugin store entry in config.yaml with auth.type: header but missing or blank auth.header-name.

Common situations: Hand-edited YAML where the header-name key was typo'd (e.g. headerName) or omitted; migrating a bearer-auth store to header auth and forgetting the new field.

Related errors


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