Mintplex-Labs/anything-llm · error
[Gitlab Loader]: not in ready state!
Error message
[Gitlab Loader]: not in ready state!
What it means
GitLabRepoLoader.recursiveLoader requires ready===true. init() returns undefined if #validGitlabUrl() does not match — the URL must be http(s)://host/{author}/{project}. Unlike GitHub, GitLab supports self-hosted instances.
Source
Thrown at collector/utils/extensions/RepoLoader/GitlabRepo/RepoLoader/index.js:124
/**
* Initializes the RepoLoader instance.
* @returns {Promise<RepoLoader>} The initialized RepoLoader instance.
*/
async init() {
if (!this.#validGitlabUrl()) return;
await this.#validBranch();
await this.#validateAccessToken();
this.ready = true;
return this;
}
/**
* Recursively loads the repository content.
* @returns {Promise<Array<Object>>} An array of loaded documents.
* @throws {Error} If the RepoLoader is not in a ready state.
*/
async recursiveLoader() {
if (!this.ready) throw new Error("[Gitlab Loader]: not in ready state!");
if (this.accessToken)
console.log(
`[Gitlab Loader]: Access token set! Recursive loading enabled for ${this.repo}!`
);
const docs = [];
console.log(`[Gitlab Loader]: Fetching files.`);
const files = await this.fetchFilesRecursive();
console.log(`[Gitlab Loader]: Fetched ${files.length} files.`);
for (const file of files) {
if (this.ignoreFilter.ignores(file.path)) continue;
docs.push({View on GitHub (pinned to 526360e320)
Solutions
- Await init() and check readiness before loading.
- Ensure the URL matches http(s)://<host>/<author>/<project>.
- Call recursiveLoader only after init succeeds.
Example fix
// before
const loader = new GitLabRepoLoader({ repo });
await loader.recursiveLoader();
// after
const loader = await new GitLabRepoLoader({ repo }).init();
if (!loader?.ready) throw new Error("Invalid GitLab URL");
await loader.recursiveLoader(); Defensive patterns
Strategy: validation
Validate before calling
async function buildGitlabLoader(args) {
const loader = await new GitLabRepoLoader(args).init();
return loader?.ready ? loader : null;
} Type guard
function isReady(loader) { return !!loader && loader.ready === true; } Try / catch
try { await loader.recursiveLoader(); }
catch (e) {
if (e.message === "[Gitlab Loader]: not in ready state!") { /* fix URL / re-init */ }
throw e;
} Prevention
- Await init() before any load call.
- Validate URL shape matches host/author/project.
- Have init() throw rather than silently return.
When it happens
Trigger: recursiveLoader called without init(), or init() returned because the repo URL did not match the author/project regex (missing project segment, non-http(s) scheme, malformed URL).
Common situations: URL missing the project segment; non-http(s) scheme; malformed URL; forgot init().
Related errors
- [Gitea Loader]: not in ready state!
- [GitHub Loader]: not in ready state!
- Failed to sync GitLab file content. ${reason}
- Failed to generate user recovery codes!
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/da31865a622566ad.
Report an issue: GitHub.