sipeed/picoclaw · error

expected mapping node, got %v

Error message

expected mapping node, got %v

What it means

Error "expected mapping node, got %v" thrown in sipeed/picoclaw.

Source

Thrown at pkg/config/config_channel.go:415

	collectSensitive(reflect.ValueOf(b.extend), &values)
	return values
}

// ChannelsConfig maps channel name to its Channel configuration.
// Each Channel stores the full channel config in Settings and handles
// JSON/YAML serialization (removing/keeping secure fields automatically).
//
//nolint:recvcheck
type ChannelsConfig map[string]*Channel

// UnmarshalYAML implements yaml.Unmarshaler for ChannelsConfig.
// This ensures that when loading security.yml, existing Channel instances
// are properly merged rather than replaced with new ones.
func (c *ChannelsConfig) UnmarshalYAML(value *yaml.Node) error {
	// yaml.Node Content for a mapping contains alternating key-value nodes
	// We need to iterate through them in pairs
	if value.Kind != yaml.MappingNode {
		return fmt.Errorf("expected mapping node, got %v", value.Kind)
	}

	if *c == nil {
		*c = make(ChannelsConfig)
	}

	for i := 0; i < len(value.Content); i += 2 {
		if i+1 >= len(value.Content) {
			break
		}
		name := value.Content[i].Value
		node := value.Content[i+1]

		existingBC := (*c)[name]
		if existingBC != nil {
			// Channel already exists - call UnmarshalYAML on it
			// This merges security.yml settings into existing config
			if err := existingBC.UnmarshalYAML(node); err != nil {

View on GitHub (pinned to 49183d7e8d)

When it happens

Trigger: Thrown at pkg/config/config_channel.go:415 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/e7ec4b5d9b9bf728. Report an issue: GitHub.