[GH-ISSUE #35] A Series of Error I Encountered #16

Closed
opened 2026-02-27 15:54:34 +03:00 by kerem · 8 comments
Owner

Originally created by @dangjinghao on GitHub (Jun 28, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/35

My docker-compose.yml:

services:
  // ...
  gitea-mirror:
    image: ghcr.io/arunavo4/gitea-mirror:latest
    restart: always
    container_name: gitea-mirror
    volumes:
      - gitea-mirror-data:/app/data
volumes:
  gitea-mirror-data:

The caddy in docker container can reverse proxy this service in same network, so don't worry the access problem, I can access it's website as usual.

My classical PAT scopes: repo,admin:org,user.

When I started, it prints

gitea-mirror  | Checking if recovery is needed...
gitea-mirror  | Error finding interrupted jobs: 5185 | async function findInterruptedJobs() {
gitea-mirror  | 5186 |   try {
gitea-mirror  | 5187 |     const cutoffTime = new Date;
gitea-mirror  | 5188 |     cutoffTime.setMinutes(cutoffTime.getMinutes() - 10);
gitea-mirror  | 5189 |     const staleCutoffTime = new Date;
gitea-mirror  | 5190 |     const interruptedJobs = await db2.select().from(mirrorJobs).where(and(eq(mirrorJobs.inProgress, true), or(or(isNull(mirrorJobs.lastCheckpoint), lt(mirrorJobs.lastCheckpoint, cutoffTime)), lt(mirrorJobs.startedAt, staleCutoffTime))));
gitea-mirror  |                                             ^
gitea-mirror  | TypeError: undefined is not an object (evaluating 'db2.select')
gitea-mirror  |       at findInterruptedJobs (/app/dist/scripts/startup-recovery.js:5190:38)
gitea-mirror  |       at findInterruptedJobs (/app/dist/scripts/startup-recovery.js:5184:36)
gitea-mirror  |       at hasJobsNeedingRecovery (/app/dist/scripts/startup-recovery.js:13955:54)
gitea-mirror  |       at hasJobsNeedingRecovery (/app/dist/scripts/startup-recovery.js:13953:39)
gitea-mirror  |       at runStartupRecovery (/app/dist/scripts/startup-recovery.js:13985:55)
gitea-mirror  |       at runStartupRecovery (/app/dist/scripts/startup-recovery.js:13972:35)
gitea-mirror  |       at /app/dist/scripts/startup-recovery.js:14034:19
gitea-mirror  |       at loadAndEvaluateModule (1:11)

Then, This is the configuration.

Image

Enable Enable automatic repository syncing and Enable automatic database cleanup.

It imported github data successfully.

If I enable Skip forked repositories, and import github data again. Check the Repositories page, It pops up a message An internal server error occurred, then the backend prints

gitea-mirror  | Error in repositories fetch: 15 |   logger;
gitea-mirror  | 16 |   exec(query) {
gitea-mirror  | 17 |     this.client.exec(query);
gitea-mirror  | 18 |   }
gitea-mirror  | 19 |   prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
gitea-mirror  | 20 |     const stmt = this.client.prepare(query.sql);
gitea-mirror  |                                   ^
gitea-mirror  | SQLiteError: near "=": syntax error
gitea-mirror  |       errno: 1,
gitea-mirror  |  byteOffset: 490,
gitea-mirror  | 
gitea-mirror  |       at prepare (bun:sqlite:313:37)
gitea-mirror  |       at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30)
gitea-mirror  |       at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73)
gitea-mirror  |       at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17)
gitea-mirror  |       at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19)
gitea-mirror  |       at then (/app/node_modules/drizzle-orm/query-promise.js:21:17)
gitea-mirror  | 
gitea-mirror  | Error name: SQLiteError
gitea-mirror  | Error message: near "=": syntax error
gitea-mirror  | Error stack: SQLiteError: near "=": syntax error
gitea-mirror  |     at prepare (unknown)
gitea-mirror  |     at prepare (bun:sqlite:313:37)
gitea-mirror  |     at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30)
gitea-mirror  |     at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73)
gitea-mirror  |     at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17)
gitea-mirror  |     at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19)
gitea-mirror  |     at then (/app/node_modules/drizzle-orm/query-promise.js:21:17)
gitea-mirror  |     at processTicksAndRejections (native:7:39)

However, in Repositories,dashboard page, I can preview some repositories. That's too wired.

Then, in Organizations page, it pops up {"error":"An internal server error occurred","timestamp":"2025-06-28T06:01:09.153Z"}, and the backend prints

gitea-mirror  | Error in organizations fetch: 15 |   logger;
gitea-mirror  | 16 |   exec(query) {
gitea-mirror  | 17 |     this.client.exec(query);
gitea-mirror  | 18 |   }
gitea-mirror  | 19 |   prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
gitea-mirror  | 20 |     const stmt = this.client.prepare(query.sql);
gitea-mirror  |                                   ^
gitea-mirror  | SQLiteError: near "=": syntax error
gitea-mirror  |       errno: 1,
gitea-mirror  |  byteOffset: 151,
gitea-mirror  | 
gitea-mirror  |       at prepare (bun:sqlite:313:37)
gitea-mirror  |       at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30)
gitea-mirror  |       at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73)
gitea-mirror  |       at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17)
gitea-mirror  |       at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19)
gitea-mirror  |       at then (/app/node_modules/drizzle-orm/query-promise.js:21:17)
gitea-mirror  | 
gitea-mirror  | Error name: SQLiteError
gitea-mirror  | Error message: near "=": syntax error
gitea-mirror  | Error stack: SQLiteError: near "=": syntax error
gitea-mirror  |     at prepare (unknown)
gitea-mirror  |     at prepare (bun:sqlite:313:37)
gitea-mirror  |     at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30)
gitea-mirror  |     at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73)
gitea-mirror  |     at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17)
gitea-mirror  |     at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19)
gitea-mirror  |     at then (/app/node_modules/drizzle-orm/query-promise.js:21:17)
gitea-mirror  |     at processTicksAndRejections (native:7:39)

Type of mirrored repositories: all public repo I owned(I don't have private repo), uclipboard organization(no private repo), and 2 private repos from another user and he grained me all permissions on those repos. gitea-mirror can find the last type repos, that's amazing!

I don't know what should I do now, I'm not good at this technology stack.

Thank you for your help!

By the way, is it possible to add a new exclude feature in Filtering & Behavior? It's very useful for the situation that some repos I forked are too large that I can't save them in my gitea but for others I still want to save.

Originally created by @dangjinghao on GitHub (Jun 28, 2025). Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/35 My `docker-compose.yml`: ```yml services: // ... gitea-mirror: image: ghcr.io/arunavo4/gitea-mirror:latest restart: always container_name: gitea-mirror volumes: - gitea-mirror-data:/app/data volumes: gitea-mirror-data: ``` The caddy in docker container can reverse proxy this service in same network, so don't worry the access problem, I can access it's website as usual. My classical PAT scopes: repo,admin:org,user. When I started, it prints ```txt gitea-mirror | Checking if recovery is needed... gitea-mirror | Error finding interrupted jobs: 5185 | async function findInterruptedJobs() { gitea-mirror | 5186 | try { gitea-mirror | 5187 | const cutoffTime = new Date; gitea-mirror | 5188 | cutoffTime.setMinutes(cutoffTime.getMinutes() - 10); gitea-mirror | 5189 | const staleCutoffTime = new Date; gitea-mirror | 5190 | const interruptedJobs = await db2.select().from(mirrorJobs).where(and(eq(mirrorJobs.inProgress, true), or(or(isNull(mirrorJobs.lastCheckpoint), lt(mirrorJobs.lastCheckpoint, cutoffTime)), lt(mirrorJobs.startedAt, staleCutoffTime)))); gitea-mirror | ^ gitea-mirror | TypeError: undefined is not an object (evaluating 'db2.select') gitea-mirror | at findInterruptedJobs (/app/dist/scripts/startup-recovery.js:5190:38) gitea-mirror | at findInterruptedJobs (/app/dist/scripts/startup-recovery.js:5184:36) gitea-mirror | at hasJobsNeedingRecovery (/app/dist/scripts/startup-recovery.js:13955:54) gitea-mirror | at hasJobsNeedingRecovery (/app/dist/scripts/startup-recovery.js:13953:39) gitea-mirror | at runStartupRecovery (/app/dist/scripts/startup-recovery.js:13985:55) gitea-mirror | at runStartupRecovery (/app/dist/scripts/startup-recovery.js:13972:35) gitea-mirror | at /app/dist/scripts/startup-recovery.js:14034:19 gitea-mirror | at loadAndEvaluateModule (1:11) ``` Then, This is the configuration. <img width="1130" alt="Image" src="https://github.com/user-attachments/assets/007a56c3-2dac-429c-a2b0-100f81c33d6b" /> Enable `Enable automatic repository syncing` and `Enable automatic database cleanup`. It imported github data successfully. If I enable `Skip forked repositories`, and import github data again. Check the `Repositories` page, It pops up a message `An internal server error occurred`, then the backend prints ```txt gitea-mirror | Error in repositories fetch: 15 | logger; gitea-mirror | 16 | exec(query) { gitea-mirror | 17 | this.client.exec(query); gitea-mirror | 18 | } gitea-mirror | 19 | prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) { gitea-mirror | 20 | const stmt = this.client.prepare(query.sql); gitea-mirror | ^ gitea-mirror | SQLiteError: near "=": syntax error gitea-mirror | errno: 1, gitea-mirror | byteOffset: 490, gitea-mirror | gitea-mirror | at prepare (bun:sqlite:313:37) gitea-mirror | at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30) gitea-mirror | at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73) gitea-mirror | at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17) gitea-mirror | at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19) gitea-mirror | at then (/app/node_modules/drizzle-orm/query-promise.js:21:17) gitea-mirror | gitea-mirror | Error name: SQLiteError gitea-mirror | Error message: near "=": syntax error gitea-mirror | Error stack: SQLiteError: near "=": syntax error gitea-mirror | at prepare (unknown) gitea-mirror | at prepare (bun:sqlite:313:37) gitea-mirror | at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30) gitea-mirror | at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73) gitea-mirror | at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17) gitea-mirror | at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19) gitea-mirror | at then (/app/node_modules/drizzle-orm/query-promise.js:21:17) gitea-mirror | at processTicksAndRejections (native:7:39) ``` However, in Repositories,dashboard page, I can preview some repositories. That's too wired. Then, in Organizations page, it pops up `{"error":"An internal server error occurred","timestamp":"2025-06-28T06:01:09.153Z"}`, and the backend prints ```txt gitea-mirror | Error in organizations fetch: 15 | logger; gitea-mirror | 16 | exec(query) { gitea-mirror | 17 | this.client.exec(query); gitea-mirror | 18 | } gitea-mirror | 19 | prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) { gitea-mirror | 20 | const stmt = this.client.prepare(query.sql); gitea-mirror | ^ gitea-mirror | SQLiteError: near "=": syntax error gitea-mirror | errno: 1, gitea-mirror | byteOffset: 151, gitea-mirror | gitea-mirror | at prepare (bun:sqlite:313:37) gitea-mirror | at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30) gitea-mirror | at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73) gitea-mirror | at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17) gitea-mirror | at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19) gitea-mirror | at then (/app/node_modules/drizzle-orm/query-promise.js:21:17) gitea-mirror | gitea-mirror | Error name: SQLiteError gitea-mirror | Error message: near "=": syntax error gitea-mirror | Error stack: SQLiteError: near "=": syntax error gitea-mirror | at prepare (unknown) gitea-mirror | at prepare (bun:sqlite:313:37) gitea-mirror | at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30) gitea-mirror | at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:615:73) gitea-mirror | at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:641:17) gitea-mirror | at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:649:19) gitea-mirror | at then (/app/node_modules/drizzle-orm/query-promise.js:21:17) gitea-mirror | at processTicksAndRejections (native:7:39) ``` Type of mirrored repositories: all public repo I owned(I don't have private repo), uclipboard organization(no private repo), and 2 private repos from another user and he grained me all permissions on those repos. `gitea-mirror` can find the last type repos, that's amazing! I don't know what should I do now, I'm not good at this technology stack. Thank you for your help! By the way, is it possible to add a new exclude feature in `Filtering & Behavior`? It's very useful for the situation that some repos I forked are too large that I can't save them in my gitea but for others I still want to save.
kerem closed this issue 2026-02-27 15:54:34 +03:00
Author
Owner

@arunavo4 commented on GitHub (Jul 5, 2025):

Hi @dangjinghao sorry for the late reply this week has been very hectic. I am planning to make this install a lot more painless. Will have a lot of new features also added soon. Please wait for next week

<!-- gh-comment-id:3039369898 --> @arunavo4 commented on GitHub (Jul 5, 2025): Hi @dangjinghao sorry for the late reply this week has been very hectic. I am planning to make this install a lot more painless. Will have a lot of new features also added soon. Please wait for next week
Author
Owner

@arunavo4 commented on GitHub (Jul 6, 2025):

@dangjinghao Please try 2.18 tag rather than latest

<!-- gh-comment-id:3042208778 --> @arunavo4 commented on GitHub (Jul 6, 2025): @dangjinghao Please try `2.18` tag rather than latest
Author
Owner

@arunavo4 commented on GitHub (Jul 7, 2025):

Let me know if you still have issues with the latest release

<!-- gh-comment-id:3043541991 --> @arunavo4 commented on GitHub (Jul 7, 2025): Let me know if you still have issues with the latest release
Author
Owner

@dangjinghao commented on GitHub (Jul 7, 2025):

I can't pull ghcr.io/arunavo4/gitea-mirror:2.18.0 or ghcr.io/raylabshq/gitea-mirror:2.18.0. It seems that I can't access this new organization raylabshq directly.

Image
<!-- gh-comment-id:3043571439 --> @dangjinghao commented on GitHub (Jul 7, 2025): I can't pull `ghcr.io/arunavo4/gitea-mirror:2.18.0` or `ghcr.io/raylabshq/gitea-mirror:2.18.0`. It seems that I can't access this new organization `raylabshq` directly. <img width="1344" height="369" alt="Image" src="https://github.com/user-attachments/assets/1d2e6fd5-25e0-4e5a-b6ac-1befe13f0b2e" />
Author
Owner

@arunavo4 commented on GitHub (Jul 7, 2025):

@dangjinghao Sorry my bad I had the pakage private by mistake. Please try the latest verison

docker pull ghcr.io/raylabshq/gitea-mirror:v2.20.0
<!-- gh-comment-id:3043585371 --> @arunavo4 commented on GitHub (Jul 7, 2025): @dangjinghao Sorry my bad I had the pakage `private` by mistake. Please try the latest verison ```sh docker pull ghcr.io/raylabshq/gitea-mirror:v2.20.0 ```
Author
Owner

@dangjinghao commented on GitHub (Jul 7, 2025):

All the previously mentioned bugs appear to have been fixed, great work!

However, I have encountered some new issues:

After switching from Single Organization to Mixed Mode and waiting for the POST /api/config request to return a successful response, refreshing the page still displays the Single Organization mode.

When selecting all metadata options in Repository Metadata and waiting for the request to complete, refreshing the page shows "2 of 5 selected". Additionally, if I select PR, labels or milestone, wait, and then refresh the page, the "Repository Metadata" options become unselected. It seems that only issues and wiki could be remembered.

Image Image
<!-- gh-comment-id:3043691221 --> @dangjinghao commented on GitHub (Jul 7, 2025): All the previously mentioned bugs appear to have been fixed, great work! However, I have encountered some new issues: After switching from `Single Organization` to `Mixed Mode` and waiting for the `POST /api/config` request to return a successful response, refreshing the page still displays the `Single Organization` mode. When selecting all metadata options in `Repository Metadata` and waiting for the request to complete, refreshing the page shows "2 of 5 selected". Additionally, if I select `PR`, `labels` or `milestone`, wait, and then refresh the page, the "Repository Metadata" options become unselected. It seems that only `issues` and `wiki` could be remembered. <img width="964" height="818" alt="Image" src="https://github.com/user-attachments/assets/424639a0-976e-4334-a60b-c69d0e30f710" /> <img width="979" height="806" alt="Image" src="https://github.com/user-attachments/assets/2e9c25b1-936d-4821-901c-103f52fdaf07" />
Author
Owner

@arunavo4 commented on GitHub (Jul 7, 2025):

@arunavo4 Thanks for reporting this let me take a look.

<!-- gh-comment-id:3043706115 --> @arunavo4 commented on GitHub (Jul 7, 2025): @arunavo4 Thanks for reporting this let me take a look.
Author
Owner

@arunavo4 commented on GitHub (Jul 7, 2025):

@dangjinghao Its fixed in the version v2.20.1. Close the Issue once you have verified that its resolved

<!-- gh-comment-id:3044266460 --> @arunavo4 commented on GitHub (Jul 7, 2025): @dangjinghao Its fixed in the version `v2.20.1`. Close the Issue once you have verified that its resolved
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gitea-mirror#16
No description provided.