nikivdev/code · error
storage hub response missing required variable '{}' for envi
Error message
storage hub response missing required variable '{}' for environment '{}' What it means
fetch_remote_secrets merges variables returned by the storage hub; for each required variable it falls back to var.default when the hub supplies no value. If a variable has neither a hub value nor a default, it bails rather than inserting a blank secret (src/secrets.rs:145).
Source
Thrown at src/secrets.rs:145
.bearer_auth(api_key)
.send()
.with_context(|| "failed to call storage hub")?
.error_for_status()
.with_context(|| "storage hub returned an error response")?;
let mut body: HashMap<String, String> = response
.json()
.with_context(|| "failed to parse storage hub response")?;
for var in &env_cfg.variables {
if body.contains_key(&var.key) {
continue;
}
if let Some(default) = &var.default {
body.insert(var.key.clone(), default.clone());
} else {
bail!(
"storage hub response missing required variable '{}' for environment '{}'",
var.key,
env_cfg.name
);
}
}
Ok(body)
}
fn order_variables(
env_cfg: &StorageEnvConfig,
values: &HashMap<String, String>,
) -> Vec<(String, String)> {
let mut ordered = Vec::new();
for var in &env_cfg.variables {
if let Some(value) = values.get(&var.key) {
ordered.push((var.key.clone(), value.clone()));View on GitHub (pinned to a747e741ae)
Solutions
- Set the missing variable's value on the storage hub for that environment
- Provide a `default` for the variable in config so pulls succeed without a hub value
- Verify you are pulling the intended environment name
- Check hub permissions — the variable may exist but be unreadable
Example fix
// config before: no default
Variable { key: "API_TOKEN", default: None }
// after
Variable { key: "API_TOKEN", default: Some("dev-token".into()) } Defensive patterns
Strategy: validation
Validate before calling
let missing: Vec<_> = env_cfg.vars.iter()
.filter(|v| !hub_response.contains_key(&v.key) && v.default.is_none())
.map(|v| v.key.clone()).collect();
if !missing.is_empty() { eprintln!("unset vars without defaults: {missing:?}"); return; } Try / catch
match pull_secrets(env) {
Err(e) if e.to_string().contains("missing required variable") => eprintln!("set the variable on the storage hub or add a default"),
other => other?,
} Prevention
- Give every config variable either a hub value or a default
- Validate hub responses against the variable list after config changes
- Double-check the environment name in pull commands
When it happens
Trigger: Pulling secrets for an environment where the hub response omits a variable whose key has no `default` defined in the variable config.
Common situations: A teammate deleted the variable value on the storage hub; new variable added to config but never given a value in that environment; wrong environment name pulling an incomplete dataset; permissions hiding the variable.
Related errors
- No profile selected.
- expected [{}] to be a table in global flow config
- empty resolver command for {}
- FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_I
- FLOW_CODEX_MAPLE_HOSTED_ENDPOINT and FLOW_CODEX_MAPLE_HOSTED
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/9256f5bc768d666c.
Report an issue: GitHub.