facebook/relay · error
The {} argument in exec_time_resolvers directive should be t
Error message
The {} argument in exec_time_resolvers directive should be the string name of your provider file. What it means
When building an operation, the execTimeResolvers (exec_time_resolvers) directive's named argument must be a string naming the runtime resolver provider file. Anything else (non-string constant, variable) hits the panic arm, because codegen needs a literal file name to emit the import.
Source
Thrown at compiler/crates/relay-codegen/src/build_ast.rs:445
// @exec_time_resolvers but without the exec time provider argument, exec time is enabled by default.
// `use_experimental_provider` make the exec time query use the experimental exec time exeuctor in runtime
// `use_network_normalization_provider` make the query opt in to the executeWithNetwork coordinated
// publish path at runtime. Used to explicitly route variable-gated S2C queries.
let (
exec_time_resolvers_enabled_provider,
use_experimental_provider,
use_network_normalization_provider,
) = if let Some(directive) = operation.directives.named(*EXEC_TIME_RESOLVERS) {
let parse_provider_arg = |arg_name: ArgumentName| {
directive
.arguments
.named(arg_name)
.map(|arg| match &arg.value.item {
Value::Constant(ConstantValue::String(cons)) => WithLocation {
item: *cons,
location: arg.value.location,
},
_ => panic!(
"The {} argument in exec_time_resolvers directive should be the string name of your provider file.",
arg_name.0.lookup()
),
})
};
(
parse_provider_arg(*EXEC_TIME_RESOLVERS_ENABLED_ARGUMENT),
parse_provider_arg(ArgumentName(intern!("useExperimentalProvider"))),
parse_provider_arg(ArgumentName(intern!("useNetworkNormalizationProvider"))),
)
} else {
(None, None, None)
};
let mut context = ContextualMetadata {
has_client_edges: false,
has_client_to_server_resolvers: false,
has_exec_time_resolvers_directive,View on GitHub (pinned to 668b1b85e0)
Solutions
- Set the directive argument to a literal string containing the provider file name, e.g. @exec_time_resolvers(provider: "MyQueryResolvers").
- Remove the variable and inline the provider name as a quoted string.
- Check the directive name/argument spelling matches what the compiler expects for exec_time_resolvers.
- Regenerate the operation from the tooling that owns the exec_time_resolvers directive so it emits a string constant.
Example fix
// before
query MyQuery @exec_time_resolvers(provider: $file) { ... }
// after
query MyQuery @exec_time_resolvers(provider: "MyQueryResolvers") { ... }
Defensive patterns
Strategy: validation
Validate before calling
fn validate_exec_time_resolvers(op: &ExecutableDefinition) -> Result<(), String> {
for d in op.directives() {
if d.name.item.0.contains("exec_time_resolvers") {
for a in &d.arguments {
if !matches!(a.value.item, Value::Constant(ConstantValue::String(_))) {
return Err(format!("{} must be a string", a.name.item.0));
}
}
}
}
Ok(())
}
Try / catch
let result = std::panic::catch_unwind(|| build_operation(...));
if result.is_err() { report("exec_time_resolvers argument must be a literal string"); }
Prevention
- Always pass the provider file name as a quoted literal string in exec_time_resolvers.
- Never parameterize the directive argument with a variable.
- Lint operations for non-string exec_time_resolvers arguments before compiling.
When it happens
Trigger: An operation defines a `... on Query @exec_time_resolvers(...)` style directive whose argument (looked up by arg_name) is not Value::Constant(ConstantValue::String) — e.g. a variable, number, or object — during build_operation.
Common situations: Typo or wrong value type in the exec_time_resolvers argument; injecting the provider name via a GraphQL variable; a refactor where the provider name moved into config but the directive still needs a literal string.
Related errors
- Expected at most one handle directive, got `{handle_field_di
- @__metadata directive should have only one argument!
- @__metadata directive expect only constant argument values.
- Unexpected RelayResolverMetadata on inline fragment while ge
- Unexpected parent type for resolver.
AI-assisted analysis of facebook/relay@668b1b85e0 (2026-09-02).
Data as JSON: /api/errors/54e6ae9b94587c1f.
Report an issue: GitHub.