aaif-goose/goose · error

Missing 'activities' in json response

Error message

Missing 'activities' in json response

What it means

Thrown during recipe response parsing when the JSON object is valid but has no "activities" key. Goose's recipe schema requires both "instructions" and "activities"; a model that omits the activities list produces this error.

Source

Thrown at crates/goose/src/agents/agent.rs:3852

        let clean_content = re
            .captures(&content)
            .and_then(|caps| caps.get(1).map(|m| m.as_str()))
            .unwrap_or(&content)
            .trim()
            .to_string();

        let (instructions, activities) =
            if let Ok(json_content) = serde_json::from_str::<Value>(&clean_content) {
                let instructions = json_content
                    .get("instructions")
                    .ok_or_else(|| anyhow!("Missing 'instructions' in json response"))?
                    .as_str()
                    .ok_or_else(|| anyhow!("instructions' is not a string"))?
                    .to_string();

                let activities = json_content
                    .get("activities")
                    .ok_or_else(|| anyhow!("Missing 'activities' in json response"))?
                    .as_array()
                    .ok_or_else(|| anyhow!("'activities' is not an array'"))?
                    .iter()
                    .map(|act| {
                        act.as_str()
                            .map(|s| s.to_string())
                            .ok_or(anyhow!("'activities' array element is not a string"))
                    })
                    .collect::<Result<_, _>>()?;

                (instructions, activities)
            } else {
                tracing::warn!("Failed to parse JSON, falling back to string parsing");
                // If we can't get valid JSON, try string parsing
                // Use split_once to get the content after "Instructions:".
                let after_instructions = content
                    .split_once("instructions:")
                    .map(|(_, rest)| rest)

View on GitHub (pinned to 3810898a74)

Solutions

  1. Retry the recipe generation
  2. Use a stronger model with better instruction following
  3. Reduce input length so the model completes its JSON
  4. Author the recipe manually if generation keeps failing
Defensive patterns

Strategy: retry

Validate before calling

// Rust — require both keys up front
let ok = json.get("activities").is_some() && json.get("instructions").is_some();
if !ok { /* regenerate */ }

Try / catch

// Rust — retry on missing-key errors from generation
match generate_recipe(&agent, &conversation).await {
    Ok(r) => Ok(r),
    Err(e) if e.to_string().contains("Missing 'activities'") => retry_or_fallback(e),
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: Recipe generation where the model returns only {"instructions": "..."} or renames the field ("tasks", "steps") instead of "activities".

Common situations: Models condensing output and dropping fields they deem optional; different model versions interpreting the recipe prompt differently; truncated JSON from long outputs.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/25c1474fee1612d5. Report an issue: GitHub.