{"record":{"id":"3ed1f82829da6a32","repo":"react-navigation/react-navigation","slug":"couldn-t-find-a-screen-to-navigate-to-make-sure-t","errorCode":null,"errorMessage":"Couldn't find a screen to navigate to. Make sure to provide a screen name.","messagePattern":"Couldn't find a screen to navigate to\\. Make sure to provide a screen name\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/native/src/useLinkProps.tsx","lineNumber":348,"sourceCode":"          e.currentTarget && 'target' in e.currentTarget\n            ? [undefined, null, '', '_self'].includes(e.currentTarget.target)\n            : true;\n\n        // let the browser handle the interaction\n        if (hasModifierKey || !isLeftClick || !isSelfTarget) {\n          return;\n        }\n      }\n\n      e?.preventDefault();\n\n      let cloned: NavigationAction;\n\n      if (action != null) {\n        cloned = clone(action);\n      } else {\n        if (screen == null) {\n          throw new Error(\n            \"Couldn't find a screen to navigate to. Make sure to provide a screen name.\"\n          );\n        }\n\n        cloned = clone(\n          CommonActions.navigate(\n            screen,\n            // @ts-expect-error This is already type-checked by the prop types\n            params\n          )\n        );\n\n        if (parent != null) {\n          cloned = {\n            ...cloned,\n            target: navigation.getState()?.key,\n          };\n        }","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/react-navigation/react-navigation/blob/ab1319d6bbf05eae8dc25e33cbf4dc56494e0f0c/packages/native/src/useLinkProps.tsx#L330-L366","documentation":"When building the action for a link href, the resolved state has no screen and no action could be derived, so useLinkProps throws because there is nothing to navigate to. This happens when the href parses to an empty state or the linking config maps the path to no screen.","triggerScenarios":"Calling useLinkProps/Link with an href that resolves (via getStateFromPath) to a state lacking a screen name and without a pre-built action — e.g. href='' or href='/' when no initial route is configured.","commonSituations":"Empty or root-only href strings passed to Link; linking config where getStateFromPath returns partial/empty state for the path; dynamically built hrefs that end up empty due to undefined route params.","solutions":["Provide a non-empty href with a valid screen path, e.g. href=\"/home\".","Ensure the linking config maps the path to a concrete screen name.","Validate href construction so template params never yield an empty path.","Fall back to a default route when href is empty."],"exampleFix":"// before\nconst href = `/items/${id}`; // id undefined -> '/items/undefined' or ''\n// after\nconst href = id ? `/items/${id}` : '/items';","handlingStrategy":"validation","validationCode":"if (!to || !to.startsWith('/')) {\n  throw new Error(`Invalid link target: '${to}'`);\n}","typeGuard":"function isValidHref(to: unknown): to is string {\n  return typeof to === 'string' && to.length > 1 && to.startsWith('/');\n}","tryCatchPattern":"try {\n  const { onPress, href } = useLinkProps({ to });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('screen to navigate')) {\n    navigateFallback('/home');\n  } else { throw e; }\n}","preventionTips":["Guard href construction so required params are never undefined.","Ensure linking config maps every emitted path to a concrete screen.","Add unit tests for getStateFromPath on all link templates.","Co-locate link templates with route definitions to avoid drift."],"tags":["react-navigation","linking","invalid-href","missing-screen"],"backgroundTag":"unmatched-deep-link-href","analyzedSha":"ab1319d6bbf05eae8dc25e33cbf4dc56494e0f0c","analyzedAt":"2026-08-31T14:46:19.520Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}