dgraph-io/dgraph · error
No value found
Error message
No value found
What it means
parseValue converts a query variable (varInfo with Type and Value) into a typed types.Val. If the variable's Value string is empty there is nothing to parse, so the library returns 'No value found' immediately, before any type-specific parsing.
Source
Thrown at dql/parser.go:312
vm = make(map[string]varInfo)
for k, v := range variables {
vm[k] = varInfo{
Value: v,
}
}
return vm
}
// Request stores the query text and the variable mapping.
type Request struct {
Str string
Variables map[string]string
}
func parseValue(v varInfo) (types.Val, error) {
typ := v.Type
if v.Value == "" {
return types.Val{}, errors.Errorf("No value found")
}
switch typ {
case "int":
{
if i, err := strconv.ParseInt(v.Value, 0, 64); err != nil {
return types.Val{}, errors.Wrapf(err, "Expected an int but got %v", v.Value)
} else {
return types.Val{
Tid: types.IntID,
Value: i,
}, nil
}
}
case "float":
{
if i, err := strconv.ParseFloat(v.Value, 64); err != nil {
return types.Val{}, errors.Wrapf(err, "Expected a float but got %v", v.Value)View on GitHub (pinned to 759e242be6)
Solutions
- Validate all variable values are non-empty strings before calling the parse/mutation API with the variables map
- Provide a default value for optional variables on the client side
- Check where the variables map is populated (env vars, request params) for empty inputs and reject them early
Example fix
// before
vars := map[string]string{"$name": req.Name} // may be ""
// after
if req.Name == "" { return errors.New("$name is required") }
vars := map[string]string{"$name": req.Name} Defensive patterns
Strategy: validation
Validate before calling
for k, v := range vars {
if v == "" { return fmt.Errorf("variable %s has empty value", k) }
} Prevention
- Validate the variables map before every parameterized query
- Reject empty user/env inputs at the boundary instead of passing them through
- Use distinct sentinel handling for optional variables rather than empty strings
When it happens
Trigger: Calling parseValue (reached via ParseWithNeedVars) with a variable map entry whose value is the empty string, e.g. $name="" supplied in the variables map of a parameterized DQL query.
Common situations: Client code builds the variables map from user input or env and the value is unset; template string substitution leaves a variable empty; forgetting to include a required variable so the resolver fills an empty string.
Related errors
- Expected an int but got %v
- Expected a float but got %v
- Expected a bool but got %v
- Expected a float32vector but got %v
- NQuad failed sanity check. Subject: %q, Predicate: %q, Objec
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/651aadd01a07ac81.
Report an issue: GitHub.