twentyhq/twenty · error · Error

Field "${fieldName}" not found on object "${objectName}" aft

Error message

Field "${fieldName}" not found on object "${objectName}" after ${page} page(s). Last-page fields: ${names}

What it means

findFieldByName in configure-partner-rls paginates an object's fields via cursor-based pagination and throws if the target field (e.g. partnerUser, isListed) is absent after exhausting all pages. The error lists the last page's field names to help diagnose a schema mismatch. It exists because large objects (company, opportunity) exceed the 200-cap single request, so a naive single fetch would miss fields.

Source

Thrown at packages/twenty-apps/internal/twenty-partners/src/scripts/configure-partner-rls.ts:199

    const match = data.object.fields.edges.find(
      (e) => e.node.name === fieldName,
    );

    if (match) {
      console.log(
        `  [rls:configure] ${objectName}.${fieldName} found on page ${page} ` +
          `(type=${match.node.type}, id=${match.node.id})`,
      );
      return match.node.id;
    }

    if (!data.object.fields.pageInfo.hasNextPage) {
      // Print available fields to help diagnose a schema mismatch.
      const names = data.object.fields.edges
        .map((e) => e.node.name)
        .join(', ');
      throw new Error(
        `Field "${fieldName}" not found on object "${objectName}" after ${page} page(s). ` +
          `Last-page fields: ${names}`,
      );
    }

    after = data.object.fields.pageInfo.endCursor;
  }
}

// Collects every field on an object across all cursor pages.
// Required for Opportunity which can grow; always paginate fully.
async function collectAllFields(
  metadataUrl: string,
  apiKey: string,
  objectId: string,
): Promise<{ id: string; name: string; type: string }[]> {
  const all: { id: string; name: string; type: string }[] = [];
  let after: string | null = null;

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Re-install/re-sync the app so its declared fields (partnerUser, isListed, etc.) land in metadata.
  2. Compare the printed 'Last-page fields' list against the expected field name to catch a rename.
  3. Confirm the objectName is correct and the field belongs to that object in the manifest.
  4. Re-run rls:configure after sync completes (it is idempotent).

Example fix

// before
throw new Error(`Field "${fieldName}" not found on object "${objectName}" after ${page} page(s). Last-page fields: ${names}`);

// after — also print the total field count and suggest re-sync
throw new Error(
  `Field "${fieldName}" not found on object "${objectName}" after ${page} page(s). ` +
  `Last-page fields: ${names}. Re-install/re-sync the app then re-run rls:configure.`,
);
Defensive patterns

Strategy: validation

Validate before calling

// Before running rls:configure, confirm the app's declared fields exist.
// (Equivalently: ensure the app is installed and a metadata sync has completed.)
// The script itself is the validator; to pre-empt it, run an install/sync first.
const installed = await isAppInstalledAndSynced(workspace);
if (!installed) {
  throw new Error('Install and sync the partners app before running rls:configure');
}

Prevention

When it happens

Trigger: After walking every page of object.fields for the given objectName, no edge has node.name === fieldName. Causes: the app field (e.g. partnerUser on Person) was never created because the app isn't fully installed/synced; the field was renamed or removed; querying the wrong object; metadata not refreshed after a manifest field change.

Common situations: Running rls:configure before the app finished syncing its fields; a manifest change added/renamed a field but metadata wasn't re-synced; pointing at a workspace where a different version of the app is installed.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/6c3c03799a43a9fb. Report an issue: GitHub.