{"record":{"id":"26140f6505f8c3bc","repo":"googleapis/mcp-toolbox","slug":"error-v","errorCode":null,"errorMessage":"error : %v","messagePattern":"error : (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dgraph/dgraph.go","lineNumber":412,"sourceCode":"\t}\n\tu.Path = resource\n\tu.RawQuery = params.Encode()\n\treturn u.String(), nil\n}\n\nfunc checkError(resp []byte) error {\n\tvar errResp struct {\n\t\tErrors []struct {\n\t\t\tMessage string `json:\"message\"`\n\t\t} `json:\"errors\"`\n\t}\n\n\tif err := json.Unmarshal(resp, &errResp); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal json: %v\", err)\n\t}\n\n\tif len(errResp.Errors) > 0 {\n\t\treturn fmt.Errorf(\"error : %v\", errResp.Errors)\n\t}\n\n\treturn nil\n}\n\nfunc embedParamsIntoMutation(mutation string, paramsMap map[string]interface{}) string {\n\tfor key, value := range paramsMap {\n\t\tmutation = strings.ReplaceAll(mutation, key, fmt.Sprintf(`\"%v\"`, value))\n\t}\n\treturn mutation\n}\n","sourceCodeStart":394,"sourceCodeEnd":424,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dgraph/dgraph.go#L394-L424","documentation":"Thrown by checkError when the response from RunSQL (DQL query) or doLogin successfully unmarshals but contains a non-empty \"errors\" array — Dgraph rejected the request. The whole errors array is formatted into the message. This is Dgraph's standard GraphQL-style error envelope surfaced to the caller.","triggerScenarios":"RunSQL posts a DQL query (or doLogin posts credentials) and the response JSON contains \"errors\": [{\"message\": ...}] with length > 0, e.g. syntax errors in the DQL, unknown predicates, or failed authentication.","commonSituations":"Malformed DQL syntax, querying predicates that don't exist in the schema, missing read/write ACL permissions, invalid username/password in doLogin, or an oversized/invalid mutation.","solutions":["Read the wrapped error messages to see Dgraph's own explanation (syntax, unknown field, permission denied).","Test the DQL directly against Dgraph (curl -X POST /query or the Ratel UI) to reproduce and fix the query.","Fix query syntax or add missing predicates to the Dgraph schema.","For login failures, verify the username/password and that ACLs are correctly configured."],"exampleFix":"// before (invalid DQL)\nquery := \"{ q(func: eq(name, \\\"x\\\")\" // missing closing brace\n// after\nquery := \"{ q(func: eq(name, \\\"x\\\")) }\"","handlingStrategy":"try-catch","validationCode":"// validate DQL syntax against Dgraph before shipping\ncurl -s -X POST http://dgraph:8080/query -H \"Content-Type: application/dql\" --data-binary '{ q(func: type(Entity)) { uid } }' | jq '.errors'","typeGuard":null,"tryCatchPattern":"var dgraphErr struct{ Errors []struct{ Message string `json:\"message\"` } `json:\"errors\"` }\nif err := json.Unmarshal(respBody, &dgraphErr); err == nil && len(dgraphErr.Errors) > 0 {\n    for _, e := range dgraphErr.Errors {\n        log.Printf(\"dgraph rejected the query: %s\", e.Message)\n    }\n    // fix the DQL or permissions before retrying\n}","preventionTips":["Test every DQL query in Ratel or curl before embedding it in tool configs.","Keep the Dgraph schema in sync with the predicates your queries reference.","Grant the toolbox user the ACL permissions it needs for reads/writes.","Validate login credentials and ACL configuration before deploying."],"tags":["dgraph","dql","query-error","api"],"backgroundTag":"dgraph-query-error","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"}