chenhg5/cc-connect · error
unknown platform %q, available: %v
Error message
unknown platform %q, available: %v
What it means
CreatePlatform looks up a platform factory registered via core.RegisterPlatform; if the requested name has no factory it returns this error listing all currently registered platform names, so the caller can see valid options.
Source
Thrown at core/registry.go:31
agentFactories = make(map[string]AgentFactory)
)
func RegisterPlatform(name string, factory PlatformFactory) {
platformFactories[name] = factory
}
func RegisterAgent(name string, factory AgentFactory) {
agentFactories[name] = factory
}
func CreatePlatform(name string, opts map[string]any) (Platform, error) {
f, ok := platformFactories[name]
if !ok {
available := make([]string, 0, len(platformFactories))
for k := range platformFactories {
available = append(available, k)
}
return nil, fmt.Errorf("unknown platform %q, available: %v", name, available)
}
return f(opts)
}
func ListRegisteredAgents() []string {
names := make([]string, 0, len(agentFactories))
for k := range agentFactories {
names = append(names, k)
}
return names
}
func ListRegisteredPlatforms() []string {
names := make([]string, 0, len(platformFactories))
for k := range platformFactories {
names = append(names, k)
}
return namesView on GitHub (pinned to 4000b2338a)
Solutions
- Check the 'available: [...]' list in the error and correct the name in config.toml to an exact registered name
- Rebuild without the excluding build tag (or via make without EXCLUDE=...) so the platform package is compiled in
- Import the platform's plugin file (cmd/cc-connect/plugin_platform_*.go) so its init() registers the factory
Example fix
// before (config.toml) name = "Feishu" // after name = "feishu"
Defensive patterns
Strategy: validation
Validate before calling
names := core.ListRegisteredPlatforms()
if !slices.Contains(names, cfgPlatformName) {
return fmt.Errorf("platform %q not registered; available: %v", cfgPlatformName, names)
} Try / catch
p, err := core.CreatePlatform(name, opts)
if err != nil {
var avail string
if strings.Contains(err.Error(), "unknown platform") {
fmt.Sscanf(err.Error(), "unknown platform %*q, available: %s", &avail)
}
return fmt.Errorf("fix [platform] name in config; %v", avail)
} Prevention
- Copy platform names from config.example.toml verbatim
- After changing build tags (EXCLUDE/no_*), re-check the config against the compiled-in platforms
- Call core.ListRegisteredPlatforms() at startup and fail fast with a friendly message
When it happens
Trigger: Passing a name to CreatePlatform that was never registered — e.g. building with `no_*` build tags that excluded the platform, a typo in config.toml's [platform] name, or calling CreatePlatform before the platform package's init() ran.
Common situations: config.toml names a platform like 'whatsapp' that doesn't exist; binary compiled with EXCLUDE/no_feishu tags but config still requests feishu; importing only some plugin_*.go files; case mismatch ('Feishu' vs 'feishu').
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- unknown agent %q, available: %v
- resolve home directory: %w
- opencode: %q CLI not found in PATH, install from: https://gi
- acp: agent option "cmd" or "command" is required (path or na
- acp: command %q not found in PATH: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/8632edb24c393318.
Report an issue: GitHub.