{"record":{"id":"80c663ef71d995e3","repo":"ruvnet/ruflo","slug":"anchor-task-task-id-has-no-query","errorCode":null,"errorMessage":"anchor task ${task.id} has no query","messagePattern":"anchor task (.+?) has no query","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/harness-project-anchor.ts","lineNumber":105,"sourceCode":"    schemaVersion?: string;\n    version?: string;\n    tasks?: HumanEvalTask[];\n  };\n  if (parsed.schemaVersion && parsed.schemaVersion !== PROJECT_ANCHOR_SCHEMA) {\n    throw new Error(`unsupported flywheel anchor schema: ${parsed.schemaVersion}`);\n  }\n  if (!Array.isArray(parsed.tasks) || parsed.tasks.length < 4) {\n    throw new Error('project flywheel anchor requires at least 4 labelled tasks');\n  }\n  const ids = new Set<string>();\n  for (const [index, task] of parsed.tasks.entries()) {\n    if (!task || typeof task.id !== 'string' || !/^[A-Za-z0-9._-]{1,128}$/.test(task.id)) {\n      throw new Error(`invalid anchor task id at index ${index}`);\n    }\n    if (ids.has(task.id)) throw new Error(`duplicate anchor task id: ${task.id}`);\n    ids.add(task.id);\n    if (typeof task.q !== 'string' || task.q.trim().length === 0) {\n      throw new Error(`anchor task ${task.id} has no query`);\n    }\n    if (!Array.isArray(task.labels) || task.labels.length === 0 || task.labels.some((label) => typeof label !== 'string' || !label.trim())) {\n      throw new Error(`anchor task ${task.id} requires non-empty string labels`);\n    }\n  }\n  return { version: parsed.version ?? 'project-anchor-v1', tasks: parsed.tasks };\n}\n\nfunction toSelection(\n  path: string,\n  expectedHash: string,\n): FlywheelAnchorSelection {\n  const parsed = parseTasks(path);\n  const actualHash = humanEvalHash(parsed.tasks);\n  if (actualHash !== normalizeHash(expectedHash)) {\n    throw new Error(`project flywheel anchor hash mismatch (got ${actualHash}, pinned ${normalizeHash(expectedHash)})`);\n  }\n  return {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/ruvnet/ruflo/blob/2602b642d92234c710ffbe96bfb33007d481ceab/v3/@claude-flow/cli/src/services/harness-project-anchor.ts#L87-L123","documentation":"Every anchor task must carry a non-empty `q` — the query string, trimmed before the check. The query is the input the flywheel evaluates retrieval against; a missing or blank query makes the task meaningless and would silently skew the human-relevance delta.","triggerScenarios":"A task with `q: \"\"`, `q: \"   \"`, no `q` key at all, or a non-string q; validation names the offending task id.","commonSituations":"Template tasks never filled in; whitespace-only strings from spreadsheet/CSV exports; generators using a different field name (`query` or `prompt`) than `q`.","solutions":["Write a real query string for the task named in the message","If your generator emits a different field name, map it to `q` when producing the anchor JSON","Trim and assert non-empty queries in the generator so bad rows never reach the file"],"exampleFix":"// before\n{ \"id\": \"t1\", \"q\": \" \", \"labels\": [\"api\"] }\n\n// after\n{ \"id\": \"t1\", \"q\": \"Where is the retry policy implemented?\", \"labels\": [\"src/retry.ts\"] }","handlingStrategy":"type-guard","validationCode":"function queriesFilled(tasks: Array<{ id: string; q?: unknown }>): string[] {\n  return tasks\n    .filter((t) => typeof t.q !== 'string' || t.q.trim().length === 0)\n    .map((t) => t.id);\n}","typeGuard":"interface TaskLike { id?: unknown; q?: unknown; labels?: unknown; }\n\nfunction hasQuery(task: unknown): task is TaskLike & { q: string } {\n  return typeof (task as TaskLike)?.q === 'string' && ((task as TaskLike).q as string).trim().length > 0;\n}\n\n// Usage: const missing = tasks.filter((t) => !hasQuery(t)).map((t) => t.id);","tryCatchPattern":"try {\n  return loadEffectiveFlywheelAnchor(root, opts);\n} catch (e) {\n  if (e instanceof Error && /anchor task .+ has no query$/.test(e.message)) {\n    const id = e.message.match(/anchor task (.+) has no query/)?.[1];\n    throw new Error(`Task '${id}' has an empty query — fill in a real retrieval question.`);\n  }\n  throw e;\n}","preventionTips":["Map your generator's field name (`query`, `prompt`) to `q` explicitly","Reject blank queries at generation time instead of after commit","Treat template tasks with placeholder text as a lint failure"],"tags":["schema","validation","anchor","required-field"],"backgroundTag":"schema-validation-failed","analyzedSha":"2602b642d92234c710ffbe96bfb33007d481ceab","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}