gatsbyjs/gatsby · error
External link ${to} was detected in a Link component. Use th
Error message
External link ${to} was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links What it means
Dev-only warning from gatsby-link's render: isLocalLink(to) is false, meaning the `to` prop is an external/absolute URL that the client-side router cannot navigate; the router still renders it but behavior is undefined.
Source
Thrown at packages/gatsby-link/src/index.js:154
const {
to,
getProps = this.defaultGetProps,
onClick,
onMouseEnter,
/* eslint-disable no-unused-vars */
activeClassName: $activeClassName,
activeStyle: $activeStyle,
innerRef: $innerRef,
partiallyActive,
state,
replace,
_location,
/* eslint-enable no-unused-vars */
...rest
} = this.props
if (process.env.NODE_ENV !== `production` && !isLocalLink(to)) {
console.warn(
`External link ${to} was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links`
)
}
const prefixedTo = rewriteLinkPath(to, _location.pathname)
if (!isLocalLink(prefixedTo)) {
return <a href={prefixedTo} {...rest} />
}
return (
<ReachRouterLink
to={prefixedTo}
state={state}
getProps={getProps}
innerRef={this.handleRef}
onMouseEnter={e => {
if (onMouseEnter) {
onMouseEnter(e)View on GitHub (pinned to e85d62f177)
Solutions
- Use a plain <a href> for external links
- Keep <Link> for internal site paths only (https://gatsby.dev/internal-links)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/gatsby-link/src/index.js:154 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26).
Data as JSON: /api/errors/1d83e635329c340c.
Report an issue: GitHub.