Mintplex-Labs/anything-llm · error
[Gitlab Loader]: Unauthorized request for ${endpoint}. Skipp
Error message
[Gitlab Loader]: Unauthorized request for ${endpoint}. Skipping. What it means
A paginated GitLab API request returned 401: the PRIVATE-TOKEN header sent by the loader was rejected. fetchNextPage logs this and returns null, aborting that pagination silently. The token is missing, malformed, expired, or revoked — unlike 403, this is an authentication failure, not a permission one.
Source
Thrown at collector/utils/extensions/RepoLoader/GitlabRepo/RepoLoader/index.js:408
});
if (response.status === 429) {
if (retries >= MAX_RETRIES) {
console.warn(
`[Gitlab Loader]: Rate limit persists for ${endpoint} after ${retries} retries. Skipping.`
);
return null;
}
const retryAfter = Number(response.headers.get("retry-after")) || 60;
console.warn(
`[Gitlab Loader]: Rate limit hit for ${endpoint}. Waiting ${retryAfter}s before retrying...`
);
await this.#wait(retryAfter * 1000);
return this.fetchNextPage(requestData, retries + 1);
}
if (response.status === 401) {
console.warn(
`[Gitlab Loader]: Unauthorized request for ${endpoint}. Skipping.`
);
return null;
}
if (!response.ok) {
console.warn(
`[Gitlab Loader]: Unexpected status ${response.status} for ${endpoint}. Skipping.`
);
return null;
}
const data = await response.json();
if (!Array.isArray(data)) {
console.warn(`Unexpected response format for ${endpoint}:`, data);
return [];
}
View on GitHub (pinned to 3aec848f28)
Solutions
- Create a fresh GitLab personal access token with read_api scope and update the connector config.
- Confirm the token belongs to the same GitLab instance as the configured API base URL.
- Re-paste the token carefully (no whitespace/newline) and re-run the sync.
- If the project is private, ensure a token is provided at all.
Defensive patterns
Strategy: validation
Validate before calling
// Preflight a GitLab PAT before syncing:
const resp = await fetch(`${apiBase}/api/v4/user`, {
headers: { 'PRIVATE-TOKEN': accessToken },
});
if (resp.status === 401) throw new Error('GitLab token invalid — update connector credentials'); Try / catch
const page = await loader.fetchNextPage(req);
if (page === null) throw new Error('pagination aborted — verify GitLab token/project access'); Prevention
- Create PATs with read_api scope and record their expiry dates.
- Trim whitespace when storing tokens in connector settings.
- Keep apiBase and the token's home instance in sync after migrations.
- Preflight the token against /api/v4/user in CI before long sync jobs.
When it happens
Trigger: Expired/revoked PAT passed as the GitLab access token; token with a trailing newline or space from copy/paste; token from a different GitLab instance than apiBase; loading a private project with no token at all.
Common situations: Token rotation policies invalidating stored connector credentials; mistaking a deploy trigger token for an API token; wrong instance URL after migrating GitLab hosts.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- [Gitea Loader]: Unauthorized request for ${endpoint}. Skippi
- [Gitlab Loader]: Rate limit persists for ${sourceFilePath} a
- [Gitlab Loader]: Rate limit hit fetching ${sourceFilePath}.
- [Gitlab Loader]: Rate limit persists for ${endpoint} after $
- [Gitlab Loader]: Rate limit hit for ${endpoint}. Waiting ${r
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/fa16051c1233d77a.
Report an issue: GitHub.