bcicen/ctop · error

invalid connector type "%s"

Error message

invalid connector type "%s"

What it means

connector.ByName looks up the requested connector name in the enabled map (populated per-platform by Enabled()). If the name is absent — either an unknown type or not enabled on this platform — it returns 'invalid connector type "%s"'.

Source

Thrown at connector/main.go:103

	}
}

// Enabled returns names for all enabled connectors on the current platform
func Enabled() (a []string) {
	for k, _ := range enabled {
		a = append(a, k)
	}
	sort.Strings(a)
	return a
}

// ByName returns a ConnectorSuper for a given name, or error if the connector
// does not exists on the current platform
func ByName(s string) (*ConnectorSuper, error) {
	if cfn, ok := enabled[s]; ok {
		return NewConnectorSuper(cfn), nil
	}
	return nil, fmt.Errorf("invalid connector type \"%s\"", s)
}

View on GitHub (pinned to 59f00dd6aa)

Solutions

  1. Check connector.Enabled() for valid names on this platform and fix the config value
  2. Correct typos in the connector name passed to ByName
  3. Ensure the package registering the connector is imported (blank import) for the target platform

Example fix

// before
cs, err := connector.ByName("docke") // invalid connector type
// after
names, _ := connector.Enabled()
cs, err := connector.ByName(names[0]) // e.g. "docker"
Defensive patterns

Strategy: validation

Validate before calling

names, _ := connector.Enabled()
if !slices.Contains(names, name) { return fmt.Errorf("connector %q not available; valid: %v", name, names) }
cs, err := connector.ByName(name)

Type guard

func connectorAvailable(name string) bool { names, _ := connector.Enabled(); return slices.Contains(names, name) }

Try / catch

cs, err := connector.ByName(name)
if err != nil && strings.HasPrefix(err.Error(), "invalid connector type") {
    // correct config or pick first enabled connector
}

Prevention

When it happens

Trigger: Calling connector.ByName with a name not present in the enabled map: typo, unsupported connector on the current OS, or the connector's platform registration not run (blank import missing).

Common situations: Config file referencing connector type "docke" (typo); using a connector unsupported on macOS/Windows; missing side-effect import that registers the connector.


AI-assisted analysis of bcicen/ctop@59f00dd6aa (2026-09-02). Data as JSON: /api/errors/c03c3f7265539db4. Report an issue: GitHub.