router-for-me/CLIProxyAPI · error

plugin store resolved auth missing header-name

Error message

plugin store resolved auth missing header-name

What it means

Thrown while materializing resolved plugin-store auth of type 'header': the header name is empty or only whitespace. The pluginstore package (internal/pluginstore/auth.go) requires that a header-type auth rule define both a header name and a value before it can set an Authorization-style header on an outgoing registry/metadata/artifact request. This is a configuration-completeness check, not a network failure.

Source

Thrown at internal/pluginstore/auth.go:298

			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))
		credential = append(credential, item.Username...)
		credential = append(credential, ':')
		credential = append(credential, item.Password...)
		encoded := base64.StdEncoding.EncodeToString(credential)
		for index := range credential {
			credential[index] = 0
		}
		headers.Set("Authorization", "Basic "+encoded)
	case AuthTypeHeader:
		if strings.TrimSpace(item.HeaderName) == "" {
			return false, fmt.Errorf("plugin store resolved auth missing header-name")
		}
		if len(item.HeaderValue) == 0 {
			return false, fmt.Errorf("plugin store resolved auth header value is empty")
		}
		headers.Set(item.HeaderName, string(item.HeaderValue))
	default:
		return false, fmt.Errorf("unsupported plugin store resolved auth type %q", item.Type)
	}
	return true, nil
}

func validatePluginStoreRequestURL(auth []AuthConfig, requestURL string, kind string) error {
	parsed, errParse := url.Parse(strings.TrimSpace(requestURL))
	if errParse != nil || parsed.Scheme == "" || parsed.Host == "" {
		return fmt.Errorf("invalid plugin store url")
	}
	if parsed.User != nil {
		return fmt.Errorf("plugin store url must not contain credentials")

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Set header-name to a valid HTTP header name (e.g. X-Api-Key) on the header-type auth rule in config.yaml
  2. Verify YAML indentation so header-name is a sibling of type/match, not nested elsewhere
  3. If configuring via management API or resolved auth configs, ensure HeaderName is non-empty before calling ResolvedAuthForRequest
  4. Re-run the store operation and confirm the error is gone

Example fix

# before
plugin-store:
  auth:
    - match: https://plugins.example.com
      type: header
      header-value-env: PLUGIN_API_KEY

# after
plugin-store:
  auth:
    - match: https://plugins.example.com
      type: header
      header-name: X-Api-Key
      header-value-env: PLUGIN_API_KEY
Defensive patterns

Strategy: validation

Validate before calling

func hasHeaderName(r ResolvedAuthConfig) bool {
	return strings.EqualFold(strings.TrimSpace(r.Type), AuthTypeHeader) &&
		strings.TrimSpace(r.HeaderName) != ""
}

Prevention

When it happens

Trigger: A plugin store auth entry in config.yaml has type: header but the header-name field (or HEADER_NAME in the resolved config) is missing, empty, or contains only spaces, and a request URL matching that rule is about to be authenticated.

Common situations: Author copies a bearer-auth example and switches type to header without adding header-name; YAML indentation puts header-name under the wrong mapping; a management API / snapshot omits the field; trailing whitespace typo like header-name: "".

Related errors


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