{"record":{"id":"50fa9c582cdc8055","repo":"dgraph-io/dgraph","slug":"found-unexpected-value-s","errorCode":null,"errorMessage":"found unexpected value: %s","messagePattern":"found unexpected value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/wrappers.go","lineNumber":2986,"sourceCode":"\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tl = append(l, elemVal)\n\t\t}\n\t\treturn l, nil\n\tcase ast.Variable:\n\t\tvars[value.Raw] = true\n\t\treturn value.String(), nil\n\tcase ast.IntValue:\n\t\treturn strconv.ParseInt(value.Raw, 10, 64)\n\tcase ast.FloatValue:\n\t\treturn strconv.ParseFloat(value.Raw, 64)\n\tcase ast.BooleanValue:\n\t\treturn strconv.ParseBool(value.Raw)\n\tcase ast.StringValue:\n\t\treturn value.Raw, nil\n\tcase ast.BlockValue, ast.EnumValue:\n\t\tif strictJSON {\n\t\t\treturn nil, fmt.Errorf(\"found unexpected value: %s\", value.String())\n\t\t}\n\t\treturn value.Raw, nil\n\tcase ast.NullValue:\n\t\treturn nil, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown value kind: %d, for value: %s\", value.Kind, value.String())\n\t}\n}\n\n// Given a template for a body with variables defined, this function parses the body\n// and converts it into a JSON representation and returns that. It also returns a list of the\n// variable names that are required by this template.\n// for e.g.\n// { author: $id, post: { id: $postID }}\n// would return\n// { \"author\" : \"$id\", \"post\": { \"id\": \"$postID\" }} and { \"id\": true, \"postID\": true}\n// If the final result is not a valid JSON, then an error is returned.\n//","sourceCodeStart":2968,"sourceCodeEnd":3004,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/wrappers.go#L2968-L3004","documentation":"When converting GraphQL AST values to Go values, BlockValue (block strings) and EnumValue kinds are only accepted when strictJSON is false. This error fires when strictJSON mode is enabled and the parser encounters a block string or enum value where a JSON-compatible value is expected.","triggerScenarios":"Evaluating a value node (e.g. a variable default or argument) in strictJSON mode where the AST contains an ast.BlockValue or ast.EnumValue node.","commonSituations":"Using enum literals or triple-quoted block strings in contexts the strict JSON conversion path processes, e.g. building request bodies from templates with enum defaults.","solutions":["Disable strictJSON if enum/block values are legitimate in your context","Replace the enum literal with a string value in the template/body","Replace block strings (\"\"\"...\"\"\") with regular quoted strings","Convert enum values to their string representations before evaluation"],"exampleFix":"// before\nstatus: ACTIVE  // enum value under strictJSON\n// after\nstatus: \"ACTIVE\"","handlingStrategy":"fallback","validationCode":"switch value.Kind {\ncase ast.BooleanValue, ast.StringValue, ast.NullValue: // safe\ncase ast.BlockValue, ast.EnumValue: // not allowed under strictJSON\n  return errors.New(\"enum/block value not allowed in strict JSON mode\")\n}","typeGuard":null,"tryCatchPattern":"if err := convertValue(v); err != nil {\n  if strings.Contains(err.Error(), \"found unexpected value\") {\n    return convertNonStrict(v) // fallback path\n  }\n  return err\n}","preventionTips":["Avoid enum literals and block strings in strict-JSON contexts","Use string values instead of enum AST nodes in templates","Confirm strictJSON setting matches the data you feed the converter"],"tags":["graphql","ast","strict-mode"],"backgroundTag":"non-json-graphql-value","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}