{"record":{"id":"c03c3f7265539db4","repo":"bcicen/ctop","slug":"invalid-connector-type-s","errorCode":null,"errorMessage":"invalid connector type \"%s\"","messagePattern":"invalid connector type \"(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"connector/main.go","lineNumber":103,"sourceCode":"\t}\n}\n\n// Enabled returns names for all enabled connectors on the current platform\nfunc Enabled() (a []string) {\n\tfor k, _ := range enabled {\n\t\ta = append(a, k)\n\t}\n\tsort.Strings(a)\n\treturn a\n}\n\n// ByName returns a ConnectorSuper for a given name, or error if the connector\n// does not exists on the current platform\nfunc ByName(s string) (*ConnectorSuper, error) {\n\tif cfn, ok := enabled[s]; ok {\n\t\treturn NewConnectorSuper(cfn), nil\n\t}\n\treturn nil, fmt.Errorf(\"invalid connector type \\\"%s\\\"\", s)\n}\n","sourceCodeStart":85,"sourceCodeEnd":105,"githubUrl":"https://github.com/bcicen/ctop/blob/59f00dd6aaebf48f3bc501e174f75f815c2619f0/connector/main.go#L85-L105","documentation":"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\"'.","triggerScenarios":"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).","commonSituations":"Config file referencing connector type \"docke\" (typo); using a connector unsupported on macOS/Windows; missing side-effect import that registers the connector.","solutions":["Check connector.Enabled() for valid names on this platform and fix the config value","Correct typos in the connector name passed to ByName","Ensure the package registering the connector is imported (blank import) for the target platform"],"exampleFix":"// before\ncs, err := connector.ByName(\"docke\") // invalid connector type\n// after\nnames, _ := connector.Enabled()\ncs, err := connector.ByName(names[0]) // e.g. \"docker\"","handlingStrategy":"validation","validationCode":"names, _ := connector.Enabled()\nif !slices.Contains(names, name) { return fmt.Errorf(\"connector %q not available; valid: %v\", name, names) }\ncs, err := connector.ByName(name)","typeGuard":"func connectorAvailable(name string) bool { names, _ := connector.Enabled(); return slices.Contains(names, name) }","tryCatchPattern":"cs, err := connector.ByName(name)\nif err != nil && strings.HasPrefix(err.Error(), \"invalid connector type\") {\n    // correct config or pick first enabled connector\n}","preventionTips":["Validate connector names from config against Enabled() at startup","Register connector packages via blank imports for all target platforms","Test per-OS builds to catch platform-disabled connectors"],"tags":["configuration","connector","validation"],"backgroundTag":"invalid-connector-type","analyzedSha":"59f00dd6aaebf48f3bc501e174f75f815c2619f0","analyzedAt":"2026-09-02T23:34:03.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}