{"record":{"id":"87a1658139814715","repo":"sipeed/picoclaw","slug":"channel-q-failed-to-decode-settings-w-87a165","errorCode":null,"errorMessage":"channel %q failed to decode settings: %w","messagePattern":"channel %q failed to decode settings: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/config_channel.go","lineNumber":353,"sourceCode":"\t\treturn fmt.Errorf(\"target is nil\")\n\t}\n\tif err := b.Settings.Decode(target); err != nil {\n\t\treturn err\n\t}\n\tb.extend = target\n\treturn nil\n}\n\n// GetDecoded returns the previously decoded settings struct.\n// If Decode hasn't been called yet, it lazily decodes using the channel Type prototype.\n// Returns an error if decoding fails; the decoded value (possibly nil) is still returned\n// so callers can distinguish between \"not decoded\" and \"decode failed\".\nfunc (b *Channel) GetDecoded() (any, error) {\n\tif b.extend == nil {\n\t\t// fallback to prototype-based creation\n\t\tif target := newChannelSettings(b.Type); target != nil {\n\t\t\tif err := b.Decode(target); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"channel %q failed to decode settings: %w\", b.name, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn b.extend, nil\n}\n\n// UnmarshalYAML implements yaml.Unmarshaler for Channel.\n// Merges the YAML node into the existing Channel.\n// Supports both nested format (settings: {...}) and flat format (token: xxx).\nfunc (b *Channel) UnmarshalYAML(value *yaml.Node) error {\n\tif value.Kind == 0 {\n\t\treturn nil\n\t}\n\n\ttype alias Channel\n\ta := alias(*b)\n\terr := value.Decode(&a)\n\tif err != nil {","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/config_channel.go#L335-L371","documentation":"Channel.GetDecoded lazily decodes the channel's raw Settings into the typed settings struct for its channel type; the raw settings did not match the expected schema for that channel type. The decoded value (possibly nil) is still returned alongside the error so callers can distinguish 'not decoded yet' from 'decode failed'.","triggerScenarios":"Thrown at pkg/config/config_channel.go:353 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the channel's settings in config.json against the documented schema for that channel type","Remove or fix unknown/mistyped settings fields","Re-run channel init after editing; the decode is lazy and will retry on next access"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}