{"record":{"id":"83d6f9acc0f48853","repo":"angular/components","slug":"could-not-find-first-page-button-inside-paginator","errorCode":null,"errorMessage":"Could not find first page button inside paginator. Make sure that `showFirstLastButtons` is enabled.","messagePattern":"Could not find first page button inside paginator\\. Make sure that `showFirstLastButtons` is enabled\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/material/paginator/testing/paginator-harness.ts","lineNumber":74,"sourceCode":"\n  /* Returns whether or not the previous page button is disabled. */\n  async isPreviousPageDisabled(): Promise<boolean> {\n    const disabledValue = await (await this._previousButton()).getAttribute('aria-disabled');\n    return disabledValue == 'true';\n  }\n\n  /** Goes to the previous page in the paginator. */\n  async goToPreviousPage(): Promise<void> {\n    return (await this._previousButton()).click();\n  }\n\n  /** Goes to the first page in the paginator. */\n  async goToFirstPage(): Promise<void> {\n    const button = await this._firstPageButton();\n\n    // The first page button isn't enabled by default so we need to check for it.\n    if (!button) {\n      throw Error(\n        'Could not find first page button inside paginator. ' +\n          'Make sure that `showFirstLastButtons` is enabled.',\n      );\n    }\n\n    return button.click();\n  }\n\n  /** Goes to the last page in the paginator. */\n  async goToLastPage(): Promise<void> {\n    const button = await this._lastPageButton();\n\n    // The last page button isn't enabled by default so we need to check for it.\n    if (!button) {\n      throw Error(\n        'Could not find last page button inside paginator. ' +\n          'Make sure that `showFirstLastButtons` is enabled.',\n      );","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/material/paginator/testing/paginator-harness.ts#L56-L92","documentation":"MatPaginatorHarness `goToFirstPage()` throws because the first/last page buttons are only rendered when `showFirstLastButtons` is true. The harness found no first-page button and refuses to silently no-op.","triggerScenarios":"`await paginatorHarness.goToFirstPage()` on a `<mat-paginator>` without `[showFirstLastButtons]=\"true\"` (default is false).","commonSituations":"Paginator markup relies on defaults so first/last buttons are absent; a teammate removed the `showFirstLastButtons` input; test copied from a different paginator configuration.","solutions":["Add `showFirstLastButtons` to the paginator template","Use `goToPage()`/`nextPage()` instead if first/last buttons are intentionally disabled","Assert `showFirstLastButtons` in the component under test if it should be enabled"],"exampleFix":"// before\n<mat-paginator [pageSizeOptions]=\"[5, 10]\"></mat-paginator>\n// after\n<mat-paginator [pageSizeOptions]=\"[5, 10]\" [showFirstLastButtons]=\"true\"></mat-paginator>","handlingStrategy":"validation","validationCode":"const btn = await paginatorHarness.getFirstPageButton?.() ?? null;\n// or simply verify the template input before using the harness:\n// <mat-paginator [showFirstLastButtons]=\"true\">","typeGuard":null,"tryCatchPattern":"try {\n  await paginatorHarness.goToFirstPage();\n} catch (e) {\n  if (String(e?.message).includes('first page button')) {\n    fail('Enable showFirstLastButtons on the paginator under test');\n  }\n  throw e;\n}","preventionTips":["Set showFirstLastButtons whenever harness tests use goToFirstPage/goToLastPage","Prefer goToPage()/nextPage() when buttons are intentionally hidden","Assert paginator inputs in component tests"],"tags":["angular","material","paginator","testing","harness"],"backgroundTag":"missing-config-input","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}