{"record":{"id":"465018999bf685d8","repo":"sipeed/picoclaw","slug":"target-agent-q-not-found-in-registry","errorCode":null,"errorMessage":"target agent %q not found in registry","messagePattern":"target agent %q not found in registry","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/subturn.go","lineNumber":350,"sourceCode":"\n\t// 4. Create INDEPENDENT child context (not derived from parent ctx).\n\t// This allows the child to continue running after parent finishes gracefully.\n\t// The child has its own timeout for self-protection.\n\tchildCtx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\n\tchildID := al.generateSubTurnID()\n\n\t// Resolve the agent instance for the child turn.\n\t// When TargetAgentID is set, look up that agent from the registry so the\n\t// child runs with the target's workspace, model, tools, and system prompt.\n\t// Otherwise fall back to the parent's agent (existing behavior).\n\tvar baseAgent *AgentInstance\n\tif cfg.TargetAgentID != \"\" {\n\t\tvar ok bool\n\t\tbaseAgent, ok = al.registry.GetAgent(cfg.TargetAgentID)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"target agent %q not found in registry\", cfg.TargetAgentID)\n\t\t}\n\t} else {\n\t\tbaseAgent = parentTS.agent\n\t\tif baseAgent == nil {\n\t\t\tbaseAgent = al.registry.GetDefaultAgent()\n\t\t}\n\t}\n\tif baseAgent == nil {\n\t\treturn nil, errors.New(\"parent turnState has no agent instance\")\n\t}\n\tephemeralStore := newEphemeralSession(nil)\n\tagent := *baseAgent // shallow copy\n\tagent.Sessions = ephemeralStore\n\t// Clone the tool registry so child turn's tool registrations\n\t// don't pollute the parent's registry.\n\tif baseAgent.Tools != nil {\n\t\tagent.Tools = baseAgent.Tools.Clone()\n\t}","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/subturn.go#L332-L368","documentation":"Error \"target agent %q not found in registry\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/agent/subturn.go:350 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}