{"record":{"id":"73eea94d6e704c80","repo":"JuliusBrussee/caveman","slug":"session-value-feature-q-outside-artifact-bounds","errorCode":null,"errorMessage":"session-value feature %q outside artifact bounds","messagePattern":"session-value feature %q outside artifact bounds","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/routing/session_value.go","lineNumber":425,"sourceCode":"func sessionValueVector(specs []SessionValueFeatureSpec, state map[string]SessionValueFeatureValue) ([]float64, []float64, error) {\n\tfor name := range state {\n\t\tif _, known := sessionValueFeatureVocabulary[name]; !known {\n\t\t\treturn nil, nil, fmt.Errorf(\"unknown session-value feature %q\", name)\n\t\t}\n\t}\n\tvalues := make([]float64, len(specs))\n\tmissing := make([]float64, len(specs))\n\tfor i, spec := range specs {\n\t\tfeature, present := state[spec.Name]\n\t\tif !present || !feature.Available {\n\t\t\tif spec.Required {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"required session-value feature %q unavailable\", spec.Name)\n\t\t\t}\n\t\t\tmissing[i] = 1\n\t\t\tcontinue\n\t\t}\n\t\tif !finite(feature.Value) || feature.Value < spec.Min || feature.Value > spec.Max {\n\t\t\treturn nil, nil, fmt.Errorf(\"session-value feature %q outside artifact bounds\", spec.Name)\n\t\t}\n\t\tvalues[i] = (feature.Value - spec.Mean) / spec.Scale\n\t}\n\treturn values, missing, nil\n}\n\nfunc sessionValueEligibilityReason(features Features, candidate Candidate, baselineUnit float64, policy FrontierPolicy) string {\n\tif candidate.Provider == \"\" || candidate.Model == \"\" || unitPrice(candidate.Price) <= 0 {\n\t\treturn \"unpriced_or_invalid_candidate\"\n\t}\n\tif !policy.AllowCrossProvider && candidate.Provider != features.Provider {\n\t\treturn \"cross_provider_disabled\"\n\t}\n\tif !candidateSupports(candidate, features) {\n\t\treturn \"capability_or_context_mismatch\"\n\t}\n\treturn policyRejectReason(features, candidate, baselineUnit, policy)\n}","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/proxy/routing/session_value.go#L407-L443","documentation":"A feature value in the runtime state falls outside the [min,max] bounds declared for it in the artifact's FeatureSpecs. Because clamping assumptions baked into the model would silently distort such inputs, sessionValueVector fails closed instead of clamping, indicating extractor drift or an artifact trained on a different value distribution.","triggerScenarios":"Thrown at proxy/routing/session_value.go:425 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the artifact with bounds covering the current feature distribution","Fix the feature extractor if it is emitting values outside its intended range"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}