nexu-io/open-design · error · Error

Could not create token contract revision

Error message

Could not create token contract revision

What it means

Same createRevision-null condition as error 190, but inside the token-contract-rebuild job kind. The rebuild job drafts a revised TOKEN_SCHEMA and then asks createRevision to persist it; a null return aborts with this message.

Source

Thrown at apps/daemon/src/design-systems/generation-jobs.ts:317

            ? 'Forced rebuild'
            : 'No quality trigger';
        setStepMessage(job, 'assess-evidence', triggers);
      });
      await runStep(job, 'draft-contract-review', async () => {
        await sleep(delayMs);
        const weakCount = input.decision.weakTokens?.length ?? 0;
        setStepMessage(job, 'draft-contract-review', `Prepared TOKEN_SCHEMA rebuild request (${weakCount} weak token(s))`);
      });
      await runStep(job, 'create-revision', async () => {
        const revision = await createRevision(jobRoot, input.designSystemId, {
          feedback: input.feedback,
          baseBody: input.baseBody,
          proposedBody: input.proposedBody,
          sectionTitle: input.sectionTitle,
          jobId: job.id,
          ...(input.fileChanges?.length ? { fileChanges: input.fileChanges } : {}),
        });
        if (!revision) throw new Error('Could not create token contract revision');
        job.revisionId = revision.id;
        setStepMessage(job, 'create-revision', `Created pending token revision ${revision.id}`);
      });
      await runStep(job, 'prepare-review', async () => {
        await sleep(delayMs);
        setStepMessage(job, 'prepare-review', 'Token contract rebuild is ready for review');
      });
      completeJob(job, 'succeeded', 'Token contract rebuild ready for review');
    } catch (err) {
      failJob(job, err instanceof Error ? err.message : String(err));
    }
  }

  return { start, revise, rebuildTokenContract, get };
}

async function runStep(
  job: MutableJob,

View on GitHub (pinned to 5be4028344)

Solutions

  1. Retry the token-contract rebuild after confirming the design system exists.
  2. Ensure no concurrent rebuild/revision targets the same design system.
  3. Verify daemon data dir is writable with free space.
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  await startTokenContractRebuild({ designSystemId, root });
} catch (err) {
  if (err instanceof Error && /Could not create token contract revision/i.test(err.message)) {
    // verify the design system still exists, then retry the rebuild
  } else throw err;
}

Prevention

When it happens

Trigger: The token-contract-rebuild job reaches create-revision with input.baseBody and input.proposedBody, but createRevision returns null because the design system directory is missing, a write conflict occurred, or storage rejected the revision.

Common situations: Design system removed mid-rebuild; concurrent token rebuilds racing on the same ID; disk or permission problems in the daemon data dir.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/7edd5ae7ad3c73c9. Report an issue: GitHub.