Mintplex-Labs/anything-llm · error
[Gitea Loader]: not in ready state!
Error message
[Gitea Loader]: not in ready state!
What it means
GiteaRepoLoader.recursiveLoader requires ready===true, set by init(). If init() was never called, or returned early because #validGiteaUrl() failed (invalid protocol/pathname), ready stays false and this throws. Note init() returns undefined silently on a bad URL rather than throwing.
Source
Thrown at collector/utils/extensions/RepoLoader/GiteaRepo/RepoLoader/index.js:164
/**
* Initializes the RepoLoader instance.
* @returns {Promise<GiteaRepoLoader>} The initialized RepoLoader instance.
*/
async init() {
if (!this.#validGiteaUrl()) 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("[Gitea Loader]: not in ready state!");
if (this.accessToken)
console.log(
`[Gitea Loader]: Access token set! Recursive loading enabled for ${this.repo}!`
);
const docs = [];
console.log(`[Gitea Loader]: Fetching files.`);
const files = await this.fetchFilesRecursive();
console.log(`[Gitea Loader]: Fetched ${files.length} files.`);
for (const file of files) {
if (this.ignoreFilter.ignores(file.path)) continue;
docs.push({
pageContent: file.content,
metadata: {View on GitHub (pinned to 526360e320)
Solutions
- Always `const loader = await new GiteaRepoLoader(args).init();` and assert the return is truthy before loading.
- If init() returned falsy, fix the URL per #validGiteaUrl's checks (http(s) protocol, {host}/{author}/{project} pathname).
- Do not call recursiveLoader until init resolves with the instance.
Example fix
// before
const loader = new GiteaRepoLoader({ repo });
await loader.recursiveLoader(); // ready is false -> throws
// after
const loader = await new GiteaRepoLoader({ repo }).init();
if (!loader?.ready) throw new Error("Invalid Gitea repo URL");
await loader.recursiveLoader(); Defensive patterns
Strategy: validation
Validate before calling
async function buildGiteaLoader(args) {
const loader = await new GiteaRepoLoader(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 === "[Gitea Loader]: not in ready state!") { /* re-init / fix URL */ }
throw e;
} Prevention
- Always await init() and assert the return is the instance.
- Make init() throw on invalid URL rather than returning undefined.
- Guard recursiveLoader callers with isReady.
When it happens
Trigger: Caller instantiates the loader and calls recursiveLoader() without awaiting init(), or init() returned undefined because the repo URL failed #validGiteaUrl (non-http(s) protocol, or pathname not {author}/{project}).
Common situations: Forgot to call/await init(); the Gitea URL is malformed; URL has trailing view paths that were not normalized; init() swallowed the validation failure silently.
Related errors
- [GitHub Loader]: not in ready state!
- [Gitlab Loader]: not in ready state!
- Failed to sync Gitea 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/d054bcd385735dcf.
Report an issue: GitHub.