{"record":{"id":"da31865a622566ad","repo":"Mintplex-Labs/anything-llm","slug":"gitlab-loader-not-in-ready-state","errorCode":null,"errorMessage":"[Gitlab Loader]: not in ready state!","messagePattern":"\\[Gitlab Loader\\]: not in ready state!","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/utils/extensions/RepoLoader/GitlabRepo/RepoLoader/index.js","lineNumber":124,"sourceCode":"  /**\n   * Initializes the RepoLoader instance.\n   * @returns {Promise<RepoLoader>} The initialized RepoLoader instance.\n   */\n  async init() {\n    if (!this.#validGitlabUrl()) return;\n    await this.#validBranch();\n    await this.#validateAccessToken();\n    this.ready = true;\n    return this;\n  }\n\n  /**\n   * Recursively loads the repository content.\n   * @returns {Promise<Array<Object>>} An array of loaded documents.\n   * @throws {Error} If the RepoLoader is not in a ready state.\n   */\n  async recursiveLoader() {\n    if (!this.ready) throw new Error(\"[Gitlab Loader]: not in ready state!\");\n\n    if (this.accessToken)\n      console.log(\n        `[Gitlab Loader]: Access token set! Recursive loading enabled for ${this.repo}!`\n      );\n\n    const docs = [];\n\n    console.log(`[Gitlab Loader]: Fetching files.`);\n\n    const files = await this.fetchFilesRecursive();\n\n    console.log(`[Gitlab Loader]: Fetched ${files.length} files.`);\n\n    for (const file of files) {\n      if (this.ignoreFilter.ignores(file.path)) continue;\n\n      docs.push({","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/collector/utils/extensions/RepoLoader/GitlabRepo/RepoLoader/index.js#L106-L142","documentation":"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.","triggerScenarios":"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).","commonSituations":"URL missing the project segment; non-http(s) scheme; malformed URL; forgot init().","solutions":["Await init() and check readiness before loading.","Ensure the URL matches http(s)://<host>/<author>/<project>.","Call recursiveLoader only after init succeeds."],"exampleFix":"// before\nconst loader = new GitLabRepoLoader({ repo });\nawait loader.recursiveLoader();\n\n// after\nconst loader = await new GitLabRepoLoader({ repo }).init();\nif (!loader?.ready) throw new Error(\"Invalid GitLab URL\");\nawait loader.recursiveLoader();","handlingStrategy":"validation","validationCode":"async function buildGitlabLoader(args) {\n  const loader = await new GitLabRepoLoader(args).init();\n  return loader?.ready ? loader : null;\n}","typeGuard":"function isReady(loader) { return !!loader && loader.ready === true; }","tryCatchPattern":"try { await loader.recursiveLoader(); }\ncatch (e) {\n  if (e.message === \"[Gitlab Loader]: not in ready state!\") { /* fix URL / re-init */ }\n  throw e;\n}","preventionTips":["Await init() before any load call.","Validate URL shape matches host/author/project.","Have init() throw rather than silently return."],"tags":["gitlab","repo-loader","state","initialization"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}