sipeed/picoclaw · error

channel has unknown type

Error message

channel %q has unknown type %q

What it means

Raised by InitChannelList when a channel entry's Type (explicit or inferred from the map key) is not a registered channel type. The channel cannot be decoded into any known settings struct, so initialization fails and names both the channel and the unknown type.

Solutions

  1. Correct the channel type name in config.json to a registered type
  2. Remove the channel entry if it is no longer supported
  3. Check for typos between the channel map key and supported type names
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/config/config_channel.go:742 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/5f1142fac71aa419. Report an issue: GitHub.

Appendix: source

Thrown at pkg/config/config_channel.go:742

//     so that b.extend contains the actual settings (e.g., PicoSettings)
//
// After calling this method, callers can safely use b.extend via Decode()
// without re-parsing raw Settings.
func InitChannelList(channels ChannelsConfig) error {
	// Step 1 & 3: validate type and decode into typed settings
	for name, bc := range channels {
		if bc == nil {
			delete(channels, name)
			continue
		}
		// Ensure channel name is set from the map key
		bc.SetName(name)
		// Infer Type from map key if not explicitly set
		if bc.Type == "" {
			bc.Type = name
		}
		if !isValidChannelType(bc.Type) {
			return fmt.Errorf("channel %q has unknown type %q", name, bc.Type)
		}
		// Decode into the correct typed settings
		if target := newChannelSettings(bc.Type); target != nil {
			if err := bc.Decode(target); err != nil {
				return fmt.Errorf("channel %q failed to decode settings: %w", name, err)
			}
			// Apply env overrides for channel-specific fields via struct tags
			if err := env.Parse(target); err != nil {
				// Non-fatal: some env vars may not apply
			}
			applyTelegramStreamingEnvCompat(target)
			if err := validateChannelStreamingConfig(name, target); err != nil {
				return err
			}
		}
	}

	// Step 2: validate singleton constraints

View on GitHub (pinned to 49183d7e8d)