{"record":{"id":"a0465c3dbf36da72","repo":"mvanhorn/last30days-skill","slug":"subqueries-index-must-be-an-object","errorCode":null,"errorMessage":"subqueries[{index}] must be an object","messagePattern":"subqueries\\[(.+?)\\] must be an object","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/last30days/scripts/lib/planner.py","lineNumber":194,"sourceCode":"            raise ValueError(f\"field '{field}' must be a non-empty string\")\n\n    source_weights = raw.get(\"source_weights\")\n    if source_weights is not None and not isinstance(source_weights, dict):\n        raise ValueError(\"field 'source_weights' must be an object when provided\")\n    for source, weight in (source_weights or {}).items():\n        if (\n            not isinstance(source, str)\n            or not source.strip()\n            or isinstance(weight, bool)\n            or not isinstance(weight, (int, float))\n        ):\n            raise ValueError(\"field 'source_weights' must map source names to numbers\")\n    subqueries = raw[\"subqueries\"]\n    if not isinstance(subqueries, list) or not subqueries:\n        raise ValueError(\"field 'subqueries' must be a non-empty array\")\n    for index, subquery in enumerate(subqueries):\n        if not isinstance(subquery, dict):\n            raise ValueError(f\"subqueries[{index}] must be an object\")\n        for field in (\"search_query\", \"ranking_query\"):\n            if not isinstance(subquery.get(field), str) or not subquery[field].strip():\n                raise ValueError(f\"subqueries[{index}].{field} must be a non-empty string\")\n        sources = subquery.get(\"sources\")\n        if not isinstance(sources, list) or not sources or not all(\n            isinstance(source, str) and source.strip() for source in sources\n        ):\n            raise ValueError(f\"subqueries[{index}].sources must be a non-empty string array\")\n        weight = subquery.get(\"weight\")\n        if weight is not None and (\n            isinstance(weight, bool) or not isinstance(weight, (int, float))\n        ):\n            raise ValueError(f\"subqueries[{index}].weight must be a number when provided\")\n\n\nDEFAULT_INTENT_CAPABILITIES = {\n    \"comparison\": {\"discussion\", \"video\", \"web\", \"reference\", \"social\", \"link\", \"market\"},\n    \"how_to\": {\"discussion\", \"video\", \"web\", \"reference\", \"link\"},","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/mvanhorn/last30days-skill/blob/c7460f6114449ddfe6ea3fc2f23c3d910c0e740c/skills/last30days/scripts/lib/planner.py#L176-L212","documentation":"Per-item check in validate_external_plan: each element of subqueries must itself be a dict/object. A bare string query, null entry, or nested list fails with the offending index in the message, making it easy to locate the bad element.","triggerScenarios":"\"subqueries\": [\"rust compilers\", {...}] — the first element is a string, not an object; or a null element from a generator that skipped an item.","commonSituations":"LLMs sometimes emit shorthand string queries instead of full objects; list filtering leaves None placeholders; copy-paste of a query string into the array.","solutions":["Wrap bare strings into objects: {\"search_query\": s, \"ranking_query\": s, \"sources\": [\"reddit\"]}.","Filter out None entries before submission: [q for q in subqueries if q].","Check the index named in the error message first."],"exampleFix":"# before\n\"subqueries\": [\"rust compilers 2026\"]\n\n# after\n\"subqueries\": [{\"search_query\": \"rust compilers 2026\", \"ranking_query\": \"rust compiler release\", \"sources\": [\"reddit\"]}]","handlingStrategy":"validation","validationCode":"plan[\"subqueries\"] = [q for q in plan[\"subqueries\"] if isinstance(q, dict)]\nif not plan[\"subqueries\"]:\n    raise SystemExit(\"no valid subquery objects after filtering\")","typeGuard":"def is_subquery_object(v) -> bool:\n    return isinstance(v, dict)","tryCatchPattern":null,"preventionTips":["Normalize bare-string subqueries to full objects at the emitting side.","Use the index from the error message to find the bad element fast."],"tags":["planner","external-plan","validation","json"],"backgroundTag":null,"analyzedSha":"c7460f6114449ddfe6ea3fc2f23c3d910c0e740c","analyzedAt":"2026-08-15T03:34:49.540Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}