{"record":{"id":"96fe7b72b3228420","repo":"dagger/dagger","slug":"encode-nested-tool-arguments-w","errorCode":null,"errorMessage":"encode nested tool arguments: %w","messagePattern":"encode nested tool arguments: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/mcp.go","lineNumber":2303,"sourceCode":"\t\t}\n\t\tduration, err := time.ParseDuration(durationArg)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid timeout duration %q: %w\", durationArg, err)\n\t\t}\n\t\ttoolName, ok := args[\"tool\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid tool: expected string\")\n\t\t}\n\t\ttoolArgs, ok := args[\"arguments\"].(map[string]any)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid nested tool arguments: expected object\")\n\t\t}\n\t\tif _, err := m.LookupTool(toolName, allTools.Order); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tencodedArgs, err := json.Marshal(toolArgs)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"encode nested tool arguments: %w\", err)\n\t\t}\n\t\tctx, cancel := context.WithTimeout(ctx, duration)\n\t\tdefer cancel()\n\n\t\t// Run the nested call as the loop runs every tool call: under a\n\t\t// tool-call display span of its own, so the trace shows it as the\n\t\t// tool call it is with its arguments and logs rolled up beneath it,\n\t\t// and through MCP.Call, for the tool attributes, workspace binding and\n\t\t// result bounding that path applies.\n\t\tcall := &LLMToolCall{CallID: toolName, Name: toolName, Arguments: JSON(encodedArgs)}\n\t\tdisplays := newDisplayPhases(ctx, \"\")\n\t\tdisplays.EmitToolCall(0, call.CallID, toolName, string(encodedArgs))\n\t\tres, failed := m.Call(toolCallCtx(ctx, displays.toolCalls, call.CallID), allTools.Order, call)\n\t\tendToolCallDisplay(displays.toolCalls, call.CallID, failed, res)\n\t\tif failed {\n\t\t\tif errors.Is(ctx.Err(), context.DeadlineExceeded) {\n\t\t\t\treturn nil, fmt.Errorf(\"tool %q did not finish within %s: %w\", toolName, duration, ctx.Err())\n\t\t\t}","sourceCodeStart":2285,"sourceCodeEnd":2321,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/mcp.go#L2285-L2321","documentation":"timeoutTool: json.Marshal of the nested tool's arguments failed — the arguments object contains values that cannot be serialized to JSON.","triggerScenarios":"Thrown at core/mcp.go:2303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restrict argument values to plain JSON types","Inspect the wrapped marshal error for the offending value","Retry with simplified arguments"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}