{"record":{"id":"bf399d42c5490add","repo":"googleapis/mcp-toolbox","slug":"unable-to-execute-query-w-bf399d","errorCode":null,"errorMessage":"unable to execute query: %w","messagePattern":"unable to execute query: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/falkordb/falkordb.go","lineNumber":195,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"unable to explain query: %w\", err)\n\t\t}\n\t\treturn map[string]any{\"plan\": plan}, nil\n\t}\n\n\tvar opts *falkordb.QueryOptions\n\tif s.QueryTimeoutMs > 0 {\n\t\topts = falkordb.NewQueryOptions().SetTimeout(s.QueryTimeoutMs)\n\t}\n\n\tvar results *falkordb.QueryResult\n\tvar err error\n\tif readOnly {\n\t\tresults, err = graph.ROQuery(cypherStr, params, opts)\n\t} else {\n\t\tresults, err = graph.Query(cypherStr, params, opts)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\n\tout := convertRecords(results)\n\tif len(out) == 0 {\n\t\tif stats := mutationStats(results); len(stats) > 0 {\n\t\t\treturn map[string]any{\"stats\": stats}, nil\n\t\t}\n\t}\n\treturn out, nil\n}\n\n// convertRecords converts a query result set into JSON-compatible rows.\nfunc convertRecords(results *falkordb.QueryResult) []map[string]any {\n\tvar out []map[string]any\n\tfor results.Next() {\n\t\trecord := results.Record()\n\t\tvMap := make(map[string]any)\n\t\tkeys := record.Keys()","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/falkordb/falkordb.go#L177-L213","documentation":"Wraps any failure from falkordb-go's graph.Query or graph.ROQuery when executing a Cypher statement. Because execution is delegated to the driver, this covers syntax errors, runtime graph errors, timeouts, and connection failures — all normalized into one wrapper by RunQuery.","triggerScenarios":"RunQuery called (readOnly selects ROQuery vs Query) and the Cypher string fails to parse, references a missing graph/label/procedure, exceeds QueryTimeoutMs, or the connection drops mid-execution.","commonSituations":"Invalid Cypher syntax; calling a write via ROQuery and getting a read-only rejection; parameter type mismatches in params map; query timeout configured too low; graph deleted between calls.","solutions":["Run the Cypher directly in FalkorDB browser/cli to see the raw server error","Check readOnly flag: write queries must go through Query, not ROQuery","Validate Cypher syntax and parameter names/values match the declared parameters","Increase QueryTimeoutMs or check server-side query timeout settings"],"exampleFix":"// before\nresults, err = graph.ROQuery(cypherStr, params, opts)\n// after\nif readOnly {\n    results, err = graph.ROQuery(cypherStr, params, opts)\n} else {\n    results, err = graph.Query(cypherStr, params, opts)\n}\nif err != nil {\n    return nil, fmt.Errorf(\"unable to execute query (readonly=%v): %w\", readOnly, err)\n}","handlingStrategy":"retry","validationCode":"// Pre-validate Cypher cheaply if supported\nif strings.TrimSpace(cypherStr) == \"\" { return errors.New(\"empty cypher query\") }\nif readOnly && isWriteCypher(cypherStr) { return errors.New(\"write statement in read-only query\") }","typeGuard":"func isTimeoutErr(err error) bool {\n    return errors.Is(err, context.DeadlineExceeded) || strings.Contains(err.Error(), \"timeout\")\n}","tryCatchPattern":"results, err := graph.Query(cypherStr, params, opts)\nif err != nil {\n    if isTimeoutErr(err) {\n        // retry once with a larger timeout\n    } else if strings.Contains(err.Error(), \"Syntax error\") {\n        // do not retry; surface to caller for correction\n    }\n    return nil, fmt.Errorf(\"unable to execute query: %w\", err)\n}","preventionTips":["Validate Cypher syntax in a linter/playground before production calls","Keep read-only traffic on ROQuery to get safe rejection semantics","Set realistic QueryTimeoutMs values based on measured query latency","Test parameter names/types against the declared tool parameters"],"tags":["falkordb","cypher","query-execution"],"backgroundTag":"query-execution-failed","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"}