{"record":{"id":"a762f26366b99de0","repo":"router-for-me/CLIProxyAPI","slug":"s-weight-weight-must-be-an-integer","errorCode":null,"errorMessage":"%s.weight: weight must be an integer","messagePattern":"(.+?)\\.weight: weight must be an integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/weight.go","lineNumber":75,"sourceCode":"\tfor index, item := range sequence.Content {\n\t\tif errValidate := validateWeightMappingNode(item, fmt.Sprintf(\"%s[%d]\", path, index)); errValidate != nil {\n\t\t\treturn errValidate\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateWeightMappingNode(mapping *yaml.Node, path string) error {\n\tif mapping == nil || mapping.Kind != yaml.MappingNode {\n\t\treturn nil\n\t}\n\tfor index := 0; index+1 < len(mapping.Content); index += 2 {\n\t\tif mapping.Content[index].Value != \"weight\" {\n\t\t\tcontinue\n\t\t}\n\t\tvalue := mapping.Content[index+1]\n\t\tif value.Kind != yaml.ScalarNode || value.Tag != \"!!int\" {\n\t\t\treturn fmt.Errorf(\"%s.weight: weight must be an integer\", path)\n\t\t}\n\t\tvar weight int64\n\t\tif errDecode := value.Decode(&weight); errDecode != nil {\n\t\t\treturn fmt.Errorf(\"%s.weight: weight must be an integer\", path)\n\t\t}\n\t\tif _, errNormalize := credentialweight.Normalize(weight); errNormalize != nil {\n\t\t\treturn fmt.Errorf(\"%s.weight: %w\", path, errNormalize)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateOpenAICompatibilityWeightNodes(sequence *yaml.Node) error {\n\tif sequence == nil || sequence.Kind != yaml.SequenceNode {\n\t\treturn nil\n\t}\n\tfor providerIndex, provider := range sequence.Content {\n\t\tif provider == nil || provider.Kind != yaml.MappingNode {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/config/weight.go#L57-L93","documentation":"Error \"%s.weight: weight must be an integer\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/config/weight.go:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the weight for the named entry to an integer value.","Fix the weight field type in config.yaml for the reported key."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}