{"record":{"id":"da55a0c0e0b4aa58","repo":"sipeed/picoclaw","slug":"server-q-did-not-register-a-connection-da55a0","errorCode":null,"errorMessage":"server %q did not register a connection","messagePattern":"server %q did not register a connection","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/mcp/show.go","lineNumber":56,"sourceCode":") ([]toolDetail, error) {\n\tmgr := picomcp.NewManager()\n\tdefer func() { _ = mgr.Close() }()\n\n\tserver.Enabled = true\n\tmcpCfg := config.MCPConfig{\n\t\tToolConfig: config.ToolConfig{Enabled: true},\n\t\tServers: map[string]config.MCPServerConfig{\n\t\t\tname: server,\n\t\t},\n\t}\n\n\tif err := mgr.LoadFromMCPConfig(ctx, mcpCfg, workspacePath); err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, ok := mgr.GetServer(name)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"server %q did not register a connection\", name)\n\t}\n\n\tdetails := make([]toolDetail, 0, len(conn.Tools))\n\tfor _, tool := range conn.Tools {\n\t\tdetails = append(details, toolDetail{\n\t\t\tName:        tool.Name,\n\t\t\tDescription: tool.Description,\n\t\t\tParameters:  extractParameters(tool.InputSchema),\n\t\t})\n\t}\n\treturn details, nil\n}\n\nfunc extractParameters(schema any) []paramDetail {\n\tschemaMap := normalizeSchema(schema)\n\tproperties, ok := schemaMap[\"properties\"].(map[string]any)\n\tif !ok || len(properties) == 0 {\n\t\treturn nil","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/mcp/show.go#L38-L74","documentation":"An internal invariant in the show probe (defaultServerShowProbe, used by picoclaw mcp show). The probe forces Enabled=true on a single-server config, LoadFromMCPConfig succeeded, yet Manager.GetServer(name) found no connection. Note the show command already refuses disabled servers earlier and prints them without probing, and the manager aggregates connect failures into an error — so this branch indicates a load-registered-nothing inconsistency: a race such as the manager closing mid-load, or version skew between the CLI and pkg/mcp manager.","triggerScenarios":"ConnectServer succeeding without the connection being stored under the exact name (concurrent Close during load); a picoclaw install mixing versions so manager registration semantics differ from the helper's assumption.","commonSituations":"Rare; typically around shutdown races, partial upgrades, or refactors of the manager registration path. Ordinary connection problems produce the 'failed to connect to MCP server' wrapper instead.","solutions":["Re-run picoclaw mcp show <name> once to rule out a transient race","Check manager logs for connect/registration lines mentioning the server name","Reinstall or upgrade picoclaw so the CLI and pkg/mcp manager come from the same build","If reproducible, file a picoclaw bug with the server entry and logs"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isNotRegisteredError(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"did not register a connection\")\n}","tryCatchPattern":"details, err := serverShowProbe(ctx, name, server, workspace)\nif err != nil {\n  if isNotRegisteredError(err) {\n    details, err = serverShowProbe(ctx, name, server, workspace) // one retry for load/register races\n  }\n  if err != nil {\n    return fmt.Errorf(\"failed to connect to MCP server %q: %w\", name, err)\n  }\n}","preventionTips":["Upgrade picoclaw as a single build so CLI helpers and the manager stay in sync","Avoid probing during shutdown of the enclosing process","Report reproducible occurrences with logs — this branch signals an internal inconsistency"],"tags":["mcp","internal","race","registration"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}