can1357/oh-my-pi · error · ToolError

Bulk directive references unknown conflict id(s) ${unknown.m

Error message

Bulk directive references unknown conflict id(s) ${unknown.map(id => `#${id}`).join(", ")}. Currently registered: ${allEntries.map(e => `#${e.id}`).join(", ")}.

What it means

In per-id directive mode, content lines of the form `<id>: @side` select specific conflicts to resolve. Each referenced id must exist in the registered conflict history; if any directive references an unknown id, the tool throws this error listing both the unknown ids and all currently registered ids so the caller can correct the request atomically (nothing is applied).

Source

Thrown at packages/coding-agent/src/tools/write.ts:965

		const allEntries = history.entries();
		if (allEntries.length === 0) {
			throw new ToolError(
				"`conflict://*` has nothing to resolve — no conflicts are currently registered. Re-read the file(s) with conflicts first.",
			);
		}

		// Per-id directive mode: content made solely of `<id>: @side` lines
		// resolves each listed conflict with that side in one call. Ideal for
		// merge-hell files where dozens of pick-one blocks each need their own
		// winner — one call instead of one write per conflict. Parsed from the
		// PRE-strip content: hashline prefix stripping would otherwise eat the
		// `<id>: ` heads as echoed line numbers.
		const directives = resolveBulkDirectives(rawContent, replacementContent);
		if (directives) {
			const known = new Set(allEntries.map(entry => entry.id));
			const unknown = [...directives.keys()].filter(id => !known.has(id));
			if (unknown.length > 0) {
				throw new ToolError(
					`Bulk directive references unknown conflict id(s) ${unknown.map(id => `#${id}`).join(", ")}. Currently registered: ${allEntries.map(e => `#${e.id}`).join(", ")}.`,
				);
			}
		}
		const selectedEntries = directives ? allEntries.filter(entry => directives.has(entry.id)) : allEntries;
		const contentFor = (entry: ConflictEntry): string =>
			directives ? (directives.get(entry.id) as string) : replacementContent;

		const byFile = new Map<string, ConflictEntry[]>();
		for (const entry of selectedEntries) {
			const bucket = byFile.get(entry.absolutePath) ?? [];
			bucket.push(entry);
			byFile.set(entry.absolutePath, bucket);
		}

		const succeededFiles: { displayPath: string; count: number; header?: string }[] = [];
		const failedFiles: { displayPath: string; count: number; error: string }[] = [];
		let totalResolvedIds = 0;

View on GitHub (pinned to 9690622007)

Solutions

  1. Use the 'Currently registered' ids listed in the error message to fix the directive ids.
  2. Re-read the affected files if the registered set looks unfamiliar.
  3. Resend the write with only valid `<id>: @side` directives.
  4. Resolve one conflict per call (conflict://<id>) to avoid id mismatch in bulk mode.

Example fix

// before
content: "7: @ours\n9: @theirs" // #9 unknown
// after (registered: #2, #5)
content: "2: @ours\n5: @theirs"
Defensive patterns

Strategy: validation

Validate before calling

const registered = new Set(history.entries().map(e => e.id));
const used = [...raw.matchAll(/^(\d+):\s*@/gm)].map(m => Number(m[1]));
const unknown = used.filter(id => !registered.has(id));
if (unknown.length) throw new Error(`Unknown conflict ids: ${unknown.join(", ")}`);

Try / catch

try {
  await write("conflict://*", directiveContent);
} catch (err) {
  const m = String(err.message).match(/Currently registered: (.+)\./);
  if (m) {
    const valid = m[1].match(/#(\d+)/g);
    // rebuild directives using only listed ids
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling write with conflict://* and directive content like `3: @ours` where id 3 is not registered — due to typo, eviction, stale session state, or hallucinated ids.

Common situations: Agent mixing up ids across multiple conflicted files, ids shifting after re-reads, a partial bulk resolution in an earlier call consumed some ids, model guessing ids without re-reading.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/3b7c96ad5fdf5115. Report an issue: GitHub.