Yeachan-Heo/oh-my-codex · error · UltragoalError

Unknown ultragoal id: ${id}

Error message

Unknown ultragoal id: ${id}

What it means

A steering directive referenced a goal id that does not exist in the current plan. steeringTargets resolves every id from proposalTargetIds (targetGoalIds, or legacy targetGoalId) against plan.goals and throws on the first miss.

Source

Thrown at src/ultragoal/artifacts.ts:1202

    event: 'goal_added',
    goalId: goal.id,
    status: goal.status,
    evidence: options.evidence,
    message: goal.title,
  });
  return { plan, goal };
  });
}


function proposalTargetIds(proposal: UltragoalSteeringProposal): string[] {
  return proposal.targetGoalIds?.length ? proposal.targetGoalIds : (proposal.targetGoalId ? [proposal.targetGoalId] : []);
}

function steeringTargets(plan: UltragoalPlan, proposal: UltragoalSteeringProposal): UltragoalItem[] {
  return proposalTargetIds(proposal).map((id) => {
    const goal = plan.goals.find((candidate) => candidate.id === id);
    if (!goal) throw new UltragoalError(`Unknown ultragoal id: ${id}`);
    return goal;
  });
}

function mentionsWeakenedCompletion(...values: Array<string | undefined>): boolean {
  const normalized = values.filter(Boolean).join(' ').toLowerCase();
  return /\b(skip|bypass|weaken|remove|omit|auto[-\s]?complete|mark complete|complete faster)\b/.test(normalized)
    && /\b(test|tests|verification|review|quality gate|complete|completion)\b/.test(normalized);
}

function hasProtectedSteeringPayload(value: unknown): boolean {
  if (!value || typeof value !== 'object') return false;
  const protectedKeys = new Set([
    'aggregateCompletion',
    'brief',
    'briefPath',
    'codexObjective',
    'constraints',

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Re-read the current plan and copy the exact goal ids (plan.goals.map(g => g.id)) into the directive
  2. If the plan was reset, regenerate the directive against the new ids
  3. Remove stale ids from targetGoalIds if those goals no longer apply
  4. Guard automation by validating ids against the live plan before applying the directive

Example fix

// before
applySteering(cwd, { targetGoalIds: ['goal-old-1'], ... }); // id no longer exists

// after
const plan = await readUltragoalPlan(cwd);
const ids = plan.goals.map(g => g.id); // use these live ids
applySteering(cwd, { targetGoalIds: ids.slice(0, 2), ... });
Defensive patterns

Strategy: validation

Validate before calling

const plan = await readUltragoalPlan(cwd);
const known = new Set(plan.goals.map(g => g.id));
const targets = proposalTargetIds(directive).filter(id => known.has(id));
if (targets.length) applySteering(cwd, { ...directive, targetGoalIds: targets });

Type guard

function isValidTargetIds(ids: string[], plan: UltragoalPlan): boolean { const known = new Set(plan.goals.map(g => g.id)); return ids.every(id => known.has(id)); }

Prevention

When it happens

Trigger: Applying a steering proposal whose targetGoalIds contains an id that was removed, renamed, or belongs to a different plan; or using a stale directive captured before goals were re-created (e.g. after create-goals --force).

Common situations: Copy-pasting a steering directive between repos or after a plan reset; goals pruned/refactored while a directive was queued; typos or truncation in hand-written goal ids; automation reading ids from an outdated cached plan.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/e87b1ea7e114b53d. Report an issue: GitHub.