{"record":{"id":"7df206757bed195d","repo":"router-for-me/CLIProxyAPI","slug":"parse-plugin-priority-w","errorCode":null,"errorMessage":"parse plugin priority: %w","messagePattern":"parse plugin priority: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/config_types.go","lineNumber":73,"sourceCode":"\t}\n\n\tfor i := 0; i+1 < len(value.Content); i += 2 {\n\t\tkey := value.Content[i]\n\t\tnode := value.Content[i+1]\n\t\tif key == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch key.Value {\n\t\tcase \"enabled\":\n\t\t\tvar enabled bool\n\t\t\tif errDecodeEnabled := node.Decode(&enabled); errDecodeEnabled != nil {\n\t\t\t\treturn fmt.Errorf(\"parse plugin enabled: %w\", errDecodeEnabled)\n\t\t\t}\n\t\t\tc.Enabled = &enabled\n\t\tcase \"priority\":\n\t\t\tvar priority int\n\t\t\tif errDecodePriority := node.Decode(&priority); errDecodePriority != nil {\n\t\t\t\treturn fmt.Errorf(\"parse plugin priority: %w\", errDecodePriority)\n\t\t\t}\n\t\t\tc.Priority = priority\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// MarshalYAML returns the preserved raw plugin YAML subtree for lossless config output.\nfunc (c PluginInstanceConfig) MarshalYAML() (any, error) {\n\tif c.Raw.Kind == 0 {\n\t\treturn defaultPluginInstanceConfigNode(), nil\n\t}\n\treturn deepCopyNode(&c.Raw), nil\n}\n\nfunc defaultPluginInstanceConfigNode() *yaml.Node {\n\treturn &yaml.Node{","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/config/config_types.go#L55-L91","documentation":"Thrown while decoding the 'priority' field of a plugin instance in config.yaml. The custom PluginInstanceConfig UnmarshalYAML decodes the node under 'priority' into a Go int; on failure it returns this wrapped error. The %w chain exposes the yaml.v3 error, typically 'cannot unmarshal !!str into int' or 'cannot unmarshal !!map into int'.","triggerScenarios":"A plugins entry with priority set to a non-integer: 'priority: high', 'priority: 1.5', 'priority: \"10\"' (quoted string), 'priority: 10s' (duration syntax), or a sequence/map under the priority key.","commonSituations":"Using a descriptive priority label instead of a number; copying example configs that used floats; a hot-reload edit where priority is temporarily a placeholder string; tools templating config with quotes around all values.","solutions":["Set priority to a plain integer in config.yaml, e.g. priority: 10.","Remove quotes and decimal points: change priority: \"10\" or priority: 1.5 to priority: 10.","Do not use duration or label syntax; priority is an int, not a time or enum.","Re-run the server (or let the config watcher reload) and confirm the error disappears."],"exampleFix":"# before (config.yaml)\nplugins:\n  configs:\n    myplugin:\n      priority: \"high\"\n\n# after\nplugins:\n  configs:\n    myplugin:\n      priority: 100","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# Reject non-integer plugin priorities before starting the server.\nif grep -nE 'priority:[[:space:]]*[^0-9-]' config.yaml; then\n  echo \"plugin priority must be an integer\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use plain integers for priority; no quotes, decimals, or labels.","Document in team conventions that priority orders plugin execution (higher first).","Add a CI config lint that type-checks known plugin fields."],"tags":["config","yaml","plugins","parsing"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}