{"record":{"id":"8a126223653af339","repo":"angular/components","slug":"could-not-find-last-page-button-inside-paginator","errorCode":null,"errorMessage":"Could not find last page button inside paginator. Make sure that `showFirstLastButtons` is enabled.","messagePattern":"Could not find last 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":89,"sourceCode":"\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      );\n    }\n\n    return button.click();\n  }\n\n  /**\n   * Sets the page size of the paginator.\n   * @param size Page size that should be select.\n   */\n  async setPageSize(size: number): Promise<void> {\n    const select = await this._select();\n\n    // The select is only available if the `pageSizeOptions` are\n    // set to an array with more than one item.\n    if (!select) {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/material/paginator/testing/paginator-harness.ts#L71-L107","documentation":"MatPaginatorHarness `goToLastPage()` throws because the last-page button is not rendered unless `showFirstLastButtons` is enabled. The harness queries `_lastPageButton()` and throws when it is absent.","triggerScenarios":"`await paginatorHarness.goToLastPage()` on a paginator whose `showFirstLastButtons` input is false/omitted.","commonSituations":"Default paginator setup without the input; template regression removing the flag; copied test harness usage from a project that enables the flag.","solutions":["Set `[showFirstLastButtons]=\"true\"` on the paginator","Navigate with `goToPage(lastIndex)` or `nextPage()` when the flag is intentionally off","Check template changes that may have dropped the binding"],"exampleFix":"// before\n<mat-paginator [length]=\"100\"></mat-paginator>\n// after\n<mat-paginator [length]=\"100\" [showFirstLastButtons]=\"true\"></mat-paginator>","handlingStrategy":"validation","validationCode":"// ensure template enables the buttons before calling:\n// <mat-paginator [showFirstLastButtons]=\"true\">","typeGuard":null,"tryCatchPattern":"try {\n  await paginatorHarness.goToLastPage();\n} catch (e) {\n  if (String(e?.message).includes('last page button')) {\n    fail('Enable showFirstLastButtons on the paginator under test');\n  }\n  throw e;\n}","preventionTips":["Enable showFirstLastButtons in fixtures that use goToLastPage","Use goToPage(lastPage) as an alternative","Review template changes that toggle the flag"],"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"}