{"record":{"id":"164876ccb4006156","repo":"dgraph-io/dgraph","slug":"invalid-task-id-s","errorCode":null,"errorMessage":"invalid task ID: %s","messagePattern":"invalid task ID: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/admin/task.go","lineNumber":38,"sourceCode":"\t\"github.com/dgraph-io/dgraph/v25/worker\"\n)\n\ntype taskInput struct {\n\tId string\n}\n\nfunc resolveTask(ctx context.Context, q schema.Query) *resolve.Resolved {\n\t// Get Task ID.\n\tinput, err := getTaskInput(q)\n\tif err != nil {\n\t\treturn resolve.EmptyResult(q, err)\n\t}\n\tif input.Id == \"\" {\n\t\treturn resolve.EmptyResult(q, fmt.Errorf(\"task ID is missing\"))\n\t}\n\ttaskId, err := strconv.ParseUint(input.Id, 0, 64)\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"invalid task ID: %s\", input.Id)\n\t\treturn resolve.EmptyResult(q, err)\n\t}\n\n\t// Get TaskMeta from network.\n\treq := &pb.TaskStatusRequest{TaskId: taskId}\n\tresp, err := worker.TaskStatusOverNetwork(context.Background(), req)\n\tif err != nil {\n\t\treturn resolve.EmptyResult(q, err)\n\t}\n\tmeta := worker.TaskMeta(resp.GetTaskMeta())\n\treturn resolve.DataResult(\n\t\tq,\n\t\tmap[string]interface{}{q.Name(): map[string]interface{}{\n\t\t\t\"kind\":        meta.Kind().String(),\n\t\t\t\"status\":      meta.Status().String(),\n\t\t\t\"lastUpdated\": meta.Timestamp().Format(time.RFC3339),\n\t\t}},\n\t\tnil,","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/admin/task.go#L20-L56","documentation":"This error wraps a strconv.ParseUint failure when the GraphQL admin API tries to convert the task `id` input field into a uint64. Dgraph expects the task ID to be a numeric string (decimal or base-prefixed like 0x…); any other value makes strconv.ParseUint fail and the resolver wraps that failure with `invalid task ID: <input>` before returning an EmptyResult.","triggerScenarios":"Calling the admin API getTask/queryTask resolver `resolveTask` with `input.Id` set to a non-numeric string (e.g. \"abc\", \"12ab\", an empty-after-trim value, a UUID, or a number exceeding uint64 range like \"99999999999999999999999\"). Note ParseUint with base 0 also rejects values with signs or invalid prefixes.","commonSituations":"Pasting a human-readable job name instead of the numeric task ID returned by a prior mutation; copying an ID with whitespace or a trailing newline; scripting the admin endpoint and formatting the ID as \"task:42\"; overflowing 64-bit values when IDs come from another system.","solutions":["Pass the numeric task ID exactly as returned by the task-creating mutation (e.g. \"42\"), not a name or prefixed string","Trim whitespace and strip any label/prefix before sending the ID","Verify the ID fits in an unsigned 64-bit integer (0 to 18446744073709551615)","If IDs come from an external system, map them to Dgraph task IDs instead of passing them through"],"exampleFix":"// before\n{ getTask(input: {id: \"task:42\"}) { response } }\n// after\n{ getTask(input: {id: \"42\"}) { response } }","handlingStrategy":"validation","validationCode":"function isValidTaskID(id) {\n  return typeof id === 'string' && /^\\d+$/.test(id.trim()) && Number(id) <= 18446744073709551615n;\n}\nif (!isValidTaskID(input.id)) throw new Error('task ID must be a decimal string fitting uint64');","typeGuard":"const isNumericString = (v) => typeof v === 'string' && v.trim() !== '' && !isNaN(Number(v));","tryCatchPattern":null,"preventionTips":["Always use the numeric ID returned by the task mutation","Trim IDs before sending","Never prefix task IDs with labels"],"tags":["graphql","admin-api","input-validation"],"backgroundTag":"invalid-task-id","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}