nocobase/nocobase · error · IntentError

You want to edit a collection definition, but there is no ex

Error message

You want to edit a collection definition, but there is no existing data table definition named '${options.name}'.

What it means

The orin data-modeling defineCollections tool throws IntentError when intent is 'edit' but no collection definition with options.name exists in the collections repository. The tool distinguishes create vs edit intent and refuses to silently turn an edit into a create.

Source

Thrown at packages/plugins/@nocobase/plugin-data-source-manager/src/ai/ai-employees/orin/skills/data-modeling/tools/defineCollections.ts:202

          }
          if (options.updatedAt !== false) {
            systemFields.push(updatedAtField);
            options.updatedAt = true;
          }
          if (options.createdBy) {
            systemFields.push(createdByField);
            options.createdBy = true;
          }
          if (options.updatedBy) {
            systemFields.push(updatedByField);
            options.updatedBy = true;
          }

          const baseFields = [...systemFields, ...normalFields];
          const collection = await repo.findOne({ filter: { name: options.name }, transaction });
          if (!collection) {
            if (intent === 'edit') {
              throw new IntentError(
                `You want to edit a collection definition, but there is no existing data table definition named '${options.name}'.`,
              );
            }
            await repo.create({
              values: { ...options, fields: baseFields },
              transaction,
              context: ctx,
            });
          } else {
            if (intent === 'create') {
              throw new IntentError(
                `You want to create a collection definition, but a collection definition named '${options.name}' already exists. Please change the name of your collection definition and then invoke this tool again.`,
              );
            }
            await repo.update({
              filterByTk: options.name,
              values: _.omit(options, ['fields']),
              transaction,

View on GitHub (pinned to fa42722fef)

Solutions

  1. Re-invoke the tool with intent 'create' since the collection does not exist yet.
  2. Correct the collection name to the existing one before editing.
  3. List existing collections (e.g. via the data-metadata tools) to confirm the actual name first.
Defensive patterns

Strategy: validation

Validate before calling

const existing = await ctx.db.getRepository('collections').findOne({ filter: { name } });
const intent = existing ? 'edit' : 'create';
await defineCollectionsTool.invoke(ctx, { intent, name, fields });

Try / catch

try {
  await tool.invoke(ctx, args);
} catch (e) {
  if (e.name === 'IntentError' && e.message.includes('no existing data table definition')) {
    await tool.invoke(ctx, { ...args, intent: 'create' });
  } else throw e;
}

Prevention

When it happens

Trigger: Invoking the defineCollections AI tool (or the LLM doing so) with intent 'edit' for a collection name that was never created (or was deleted/renamed).

Common situations: The AI guessed an edit intent on a misspelled collection name; the collection lives in a different data source than the tool's repository; schema state was reset between sessions.

Related errors


AI-assisted analysis of nocobase/nocobase@fa42722fef (2026-09-01). Data as JSON: /api/errors/e3d8c4f7f2f69fe7. Report an issue: GitHub.