{"record":{"id":"0546f94514abe938","repo":"googleapis/mcp-toolbox","slug":"unable-to-execute-query-w-0546f9","errorCode":null,"errorMessage":"unable to execute query: %w","messagePattern":"unable to execute query: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cockroachdb/cockroachdbexecutesql/cockroachdbexecutesql.go","lineNumber":123,"sourceCode":"\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tparamsMap := params.AsMap()\n\tsql, ok := paramsMap[\"sql\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"parameter 'sql' is required, unable to cast %v\", paramsMap[\"sql\"]), nil)\n\t}\n\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(\"error getting logger\", http.StatusInternalServerError, err)\n\t}\n\tlogger.DebugContext(ctx, fmt.Sprintf(\"executing `%s` tool query: %s\", t.Cfg.Type, sql))\n\n\tresults, err := source.Query(ctx, sql)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(fmt.Errorf(\"unable to execute query: %w\", err))\n\t}\n\tdefer results.Close()\n\n\tfields := results.FieldDescriptions()\n\n\tout := []any{}\n\tfor results.Next() {\n\t\tv, err := results.Values()\n\t\tif err != nil {\n\t\t\treturn nil, util.NewClientServerError(\"unable to parse row\", http.StatusInternalServerError, err)\n\t\t}\n\t\trow := orderedmap.Row{}\n\t\tfor i, f := range fields {\n\t\t\trow.Add(f.Name, v[i])\n\t\t}\n\t\tout = append(out, row)\n\t}\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cockroachdb/cockroachdbexecutesql/cockroachdbexecutesql.go#L105-L141","documentation":"Runtime failure wrap in Invoke: the underlying CockroachDB (pgx) connection returned an error when executing the tool's SQL statement. The wrapped error carries the driver's diagnosis, such as a syntax error, missing table, or connectivity failure.","triggerScenarios":"Thrown at internal/tools/cockroachdb/cockroachdbexecutesql/cockroachdbexecutesql.go:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped driver error for the actual SQL failure (syntax, undefined relation, permissions)","Verify the CockroachDB connection details and credentials in the source configuration","If the statement is parameterized, pass the parameters instead of interpolating values"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}