{"record":{"id":"ab9313b3fd1ede3b","repo":"dgraph-io/dgraph","slug":"can-t-convert-input-tablet-to-string","errorCode":null,"errorMessage":"can't convert input.tablet to string","messagePattern":"can't convert input\\.tablet to string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/admin/moveTablet.go","lineNumber":69,"sourceCode":"\t\treturn nil, inputArgError(errors.Errorf(\"can't convert input to map\"))\n\t}\n\n\tinputRef := &moveTabletInput{}\n\t// namespace is an optional parameter\n\tif _, ok = inputArg[\"namespace\"]; !ok {\n\t\tinputRef.Namespace = x.RootNamespace\n\t} else {\n\t\tns, err := parseAsUint64(inputArg[\"namespace\"])\n\t\tif err != nil {\n\t\t\treturn nil, inputArgError(schema.GQLWrapf(err,\n\t\t\t\t\"can't convert input.namespace to uint64\"))\n\t\t}\n\t\tinputRef.Namespace = ns\n\t}\n\n\tinputRef.Tablet, ok = inputArg[\"tablet\"].(string)\n\tif !ok {\n\t\treturn nil, inputArgError(errors.Errorf(\"can't convert input.tablet to string\"))\n\t}\n\n\tgId, err := parseAsUint32(inputArg[\"groupId\"])\n\tif err != nil {\n\t\treturn nil, inputArgError(schema.GQLWrapf(err, \"can't convert input.groupId to uint32\"))\n\t}\n\tinputRef.GroupId = gId\n\n\treturn inputRef, nil\n}\n","sourceCodeStart":51,"sourceCodeEnd":80,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/admin/moveTablet.go#L51-L80","documentation":"After the namespace field, getMoveTabletInput asserts input.tablet to a string; if the value is absent or not a string (e.g. a number, bool, or object), this error is returned via inputArgError. The tablet parameter identifies the tablet to move and the resolver requires it as the string form of the tablet ID (or tablet address).","triggerScenarios":"Calling moveTablet without the 'tablet' field in input, or passing it as a numeric JSON value like {\"tablet\": 5} instead of {\"tablet\": \"5\"}, or passing an object/null.","commonSituations":"Clients that auto-convert tablet IDs to numbers, code generators serializing IDs as ints, or developers copying moveTablet calls from Raft output where the tablet ID is printed as a number. Also happens when the field name is misspelled ('tabletId') so 'tablet' is missing entirely.","solutions":["Pass tablet as a JSON string: {\"tablet\": \"5\"}, quoting any numeric ID.","Confirm the field is spelled exactly 'tablet' and present in the input object.","If the value comes from a variable or template, coerce it with String(id) / fmt.Sprintf(\"%d\", id) before sending.","Cross-check the tablet ID against /state or theRaft listing so the string matches an existing tablet.","Update the client schema/types if it models tablet as a number."],"exampleFix":"// before\n{\"input\": {\"tablet\": 5, \"groupId\": 1}}\n// after\n{\"input\": {\"tablet\": \"5\", \"groupId\": 1}}","handlingStrategy":"validation","validationCode":"function assertTablet(v) {\n  const t = v && v.input && v.input.tablet;\n  if (typeof t !== 'string' || t === '') throw new Error('input.tablet must be a non-empty string');\n  return t;\n}","typeGuard":"function isNonEmptyString(v) { return typeof v === 'string' && v.length > 0; }","tryCatchPattern":"try {\n  await gql(moveTabletMutation, { input: { ...input, tablet: String(input.tablet) } });\n} catch (e) {\n  if (String(e.message).includes(\"can't convert input.tablet to string\")) {\n    // coerce tablet to string (or the field is missing) and retry\n  }\n}","preventionTips":["Quote tablet IDs: send \"5\", not 5","Coerce numeric IDs with String(id) at the client boundary","Keep the field name exactly 'tablet' (not tabletId)","Type tablet as string in generated client types","Verify IDs exist via /state before issuing moveTablet"],"tags":["graphql","input-validation","type-mismatch","admin-api"],"backgroundTag":"invalid-graphql-input","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}