JuliusBrussee/caveman · error

bedrock request path

Error message

bedrock request path %q does not name a model and action

What it means

Runtime paths must have the form /bedrock/model/{modelId}/{action}; the adapter extracts the model id and trailing action segment from the path. If either part is empty — the path does not name both a model and an action — routing cannot proceed and the request is rejected.

Solutions

  1. Use the full path form /bedrock/model/{modelId}/{action}, e.g. /bedrock/model/anthropic.claude-3-5-sonnet-20241022-v2:0/invoke.
  2. Append the missing action: one of invoke, invoke-with-response-stream, converse, converse-stream, count-tokens.
  3. Remove any trailing slash from the URL so the last path segment is the action, not an empty string.
  4. Check the URL-building code — an interpolated model id that came out empty produces exactly this shape.

Example fix

// before
POST /bedrock/model/anthropic.claude-3-5-sonnet
// after
POST /bedrock/model/anthropic.claude-3-5-sonnet/invoke
Defensive patterns

Strategy: validation

Validate before calling

func runtimePathWellFormed(path string) bool {
	if !strings.HasPrefix(path, "/bedrock/model/") {
		return true
	}
	rest := strings.Trim(strings.TrimPrefix(path, "/bedrock"), "/")
	rest = strings.TrimPrefix(rest, "model/")
	idx := strings.LastIndex(rest, "/")
	return idx > 0 && idx < len(rest)-1
}

Prevention

When it happens

Trigger: A request to /bedrock/model (no model or action), /bedrock/model/anthropic.claude-3-5-sonnet (no action), /bedrock/model//invoke (empty model), or a trailing-slash path like /bedrock/model/mymodel/invoke/ where the last segment is empty.

Common situations: Hand-written or SDK-generated URLs that omit the action (e.g. forgetting /invoke or /converse); string building that appends a trailing slash; mistaking the converse or invoke API for a base-model listing endpoint.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/21856e49d25f94a5. Report an issue: GitHub.

Appendix: source

Thrown at proxy/providers/bedrock/routing.go:172

		return nil, fmt.Errorf("bedrock base url invalid: %w", err)
	}
	region, err := resolveRegion(req, base)
	if err != nil {
		return nil, err
	}

	kind := endpointKindForPath(req.URL.Path)
	if configuredKind := strings.ToLower(strings.TrimSpace(route.EndpointKind)); configuredKind != "" && configuredKind != kind {
		return nil, fmt.Errorf("bedrock configured endpoint kind %q does not allow request kind %q", configuredKind, kind)
	}
	switch kind {
	case endpointRuntime:
		if !RegionAllowed(region) {
			return nil, fmt.Errorf("bedrock region %q is not on the allowlist", region)
		}
		modelID, action := parseModelPath(req.URL.Path)
		if modelID == "" || action == "" {
			return nil, fmt.Errorf("bedrock request path %q does not name a model and action", req.URL.Path)
		}
		if !actionAllowed(action) {
			return nil, fmt.Errorf("bedrock action %q is not allowed", action)
		}
		if !modelAllowed(modelID) {
			return nil, fmt.Errorf("bedrock model %q is not on the allowlist", modelID)
		}
		base.Path = strings.TrimRight(base.Path, "/") + strings.TrimPrefix(req.URL.Path, "/bedrock")
	case endpointMantle:
		if !env.Bool("CAVE_BEDROCK_MANTLE_ENABLED", false) {
			return nil, fmt.Errorf("bedrock Mantle endpoint is not enabled")
		}
		if !MantleRegionAllowed(region) {
			return nil, fmt.Errorf("bedrock Mantle region %q is not on the allowlist", region)
		}
		if !mantleActionAllowed(req.URL.Path) {
			return nil, fmt.Errorf("bedrock Mantle path %q is not allowed", req.URL.Path)
		}

View on GitHub (pinned to 3ee70a1026)