[GH-ISSUE #19] Failed to parse JSON #9

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

Originally created by @crocofied on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/19

Hey, If I try to mirror a repository, I get this error in the docke rlogs:

vent published successfully with ID 7dea50a4-6cb5-4ad1-bd96-f02fff13643d
gitea-mirror  | Retrying repository DumbKan (attempt 2): Failed to mirror repository: Error in getOrCreateGiteaOrg: Failed to parse JSON
gitea-mirror  | Starting mirror for repository: DumbKan
gitea-mirror  | Publishing event to channel mirror-status:da1b7ef3-2749-4cac-8946-b348c747bab1 for user da1b7ef3-2749-4cac-8946-b348c747bab1
gitea-mirror  | Event published successfully with ID aff8e7a2-7217-44df-baa5-1d634ec70220
gitea-mirror  | Mirroring progress: 100% (1/1)
gitea-mirror  | Error processing item: 352 |       giteaOrgId,
gitea-mirror  | 353 |       orgName
gitea-mirror  | 354 |     });
gitea-mirror  | 355 |   } catch (error) {
gitea-mirror  | 356 |     if (error instanceof Error) {
gitea-mirror  | 357 |       throw new Error(`Failed to mirror repository: ${error.message}`);
gitea-mirror  |                   ^
gitea-mirror  | error: Failed to mirror repository: Error in getOrCreateGiteaOrg: Failed to parse JSON
gitea-mirror  |       at mirrorGitHubOrgRepoToGiteaOrg (/app/dist/server/chunks/gitea_CNhd8BBV.mjs:357:13)
gitea-mirror  | 
gitea-mirror  | Publishing event to channel mirror-status:da1b7ef3-2749-4cac-8946-b348c747bab1 for user da1b7ef3-2749-4cac-8946-b348c747bab1
gitea-mirror  | Event published successfully with ID 4d29980c-5fbd-4df2-be17-3408ecc3f740
gitea-mirror  | Unregistered job: 23c4956a-f8e6-43f8-98f3-7bfe2246f4bf (0 remaining active jobs)
gitea-mirror  | All repository mirroring tasks completed
Originally created by @crocofied on GitHub (May 27, 2025). Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/19 Hey, If I try to mirror a repository, I get this error in the docke rlogs: ``` vent published successfully with ID 7dea50a4-6cb5-4ad1-bd96-f02fff13643d gitea-mirror | Retrying repository DumbKan (attempt 2): Failed to mirror repository: Error in getOrCreateGiteaOrg: Failed to parse JSON gitea-mirror | Starting mirror for repository: DumbKan gitea-mirror | Publishing event to channel mirror-status:da1b7ef3-2749-4cac-8946-b348c747bab1 for user da1b7ef3-2749-4cac-8946-b348c747bab1 gitea-mirror | Event published successfully with ID aff8e7a2-7217-44df-baa5-1d634ec70220 gitea-mirror | Mirroring progress: 100% (1/1) gitea-mirror | Error processing item: 352 | giteaOrgId, gitea-mirror | 353 | orgName gitea-mirror | 354 | }); gitea-mirror | 355 | } catch (error) { gitea-mirror | 356 | if (error instanceof Error) { gitea-mirror | 357 | throw new Error(`Failed to mirror repository: ${error.message}`); gitea-mirror | ^ gitea-mirror | error: Failed to mirror repository: Error in getOrCreateGiteaOrg: Failed to parse JSON gitea-mirror | at mirrorGitHubOrgRepoToGiteaOrg (/app/dist/server/chunks/gitea_CNhd8BBV.mjs:357:13) gitea-mirror | gitea-mirror | Publishing event to channel mirror-status:da1b7ef3-2749-4cac-8946-b348c747bab1 for user da1b7ef3-2749-4cac-8946-b348c747bab1 gitea-mirror | Event published successfully with ID 4d29980c-5fbd-4df2-be17-3408ecc3f740 gitea-mirror | Unregistered job: 23c4956a-f8e6-43f8-98f3-7bfe2246f4bf (0 remaining active jobs) gitea-mirror | All repository mirroring tasks completed ```
kerem closed this issue 2026-02-27 15:54:30 +03:00
Author
Owner

@arunavo4 commented on GitHub (May 28, 2025):

@crocofied Thanks for reporting this issue, I am working on making the error logs more helpful and robust. Keep an eye out for new updates. I will let you know once I have tested it on my end.

<!-- gh-comment-id:2914891416 --> @arunavo4 commented on GitHub (May 28, 2025): @crocofied Thanks for reporting this issue, I am working on making the error logs more helpful and robust. Keep an eye out for new updates. I will let you know once I have tested it on my end.
Author
Owner

@arunavo4 commented on GitHub (May 28, 2025):

Hi @crocofied Please try the new v2.11.0 verison and also make sure to remove older docker volumns and best to try with a fresh Gitea instance to rule out any issues on gitea side

<!-- gh-comment-id:2915501469 --> @arunavo4 commented on GitHub (May 28, 2025): Hi @crocofied Please try the new `v2.11.0` verison and also make sure to remove older docker volumns and best to try with a fresh Gitea instance to rule out any issues on gitea side
Author
Owner

@crocofied commented on GitHub (May 28, 2025):

@arunavo4
Getting this log messages now:
gitea-mirror | 2025-05-28T09:26:44.928973400Z Created new job 8db03dec-b332-4407-957b-a19553632daa with 1 items gitea-mirror | 2025-05-28T09:26:44.929028834Z Registered active job: 8db03dec-b332-4407-957b-a19553632daa (1 total active jobs) gitea-mirror | 2025-05-28T09:26:44.933345296Z Starting mirror for repository: AdminData gitea-mirror | 2025-05-28T09:26:45.173086326Z Repository AdminData already exists in Gitea. Skipping migration. gitea-mirror | 2025-05-28T09:26:45.173148342Z Mirroring progress: 100% (1/1) gitea-mirror | 2025-05-28T09:26:45.173157841Z Successfully mirrored repository: AdminData gitea-mirror | 2025-05-28T09:26:45.193587243Z Publishing event to channel mirror-status:03b9a235-8173-49d9-8c20-e6bc0f7a8d10 for user 03b9a235-8173-49d9-8c20-e6bc0f7a8d10 gitea-mirror | 2025-05-28T09:26:45.208836715Z Event published successfully with ID fe24e990-a5b8-49c3-ae0d-4b427065a382 gitea-mirror | 2025-05-28T09:26:45.221634853Z Publishing event to channel mirror-status:03b9a235-8173-49d9-8c20-e6bc0f7a8d10 for user 03b9a235-8173-49d9-8c20-e6bc0f7a8d10 gitea-mirror | 2025-05-28T09:26:45.233752633Z Event published successfully with ID 94f6975e-db75-423f-a9a9-287c1164aae7 gitea-mirror | 2025-05-28T09:26:45.233805836Z Unregistered job: 8db03dec-b332-4407-957b-a19553632daa (0 remaining active jobs) gitea-mirror | 2025-05-28T09:26:45.233815922Z All repository mirroring tasks completed

Its a new gitea instance without any repositorys

<!-- gh-comment-id:2915620906 --> @crocofied commented on GitHub (May 28, 2025): @arunavo4 Getting this log messages now: ` gitea-mirror | 2025-05-28T09:26:44.928973400Z Created new job 8db03dec-b332-4407-957b-a19553632daa with 1 items gitea-mirror | 2025-05-28T09:26:44.929028834Z Registered active job: 8db03dec-b332-4407-957b-a19553632daa (1 total active jobs) gitea-mirror | 2025-05-28T09:26:44.933345296Z Starting mirror for repository: AdminData gitea-mirror | 2025-05-28T09:26:45.173086326Z Repository AdminData already exists in Gitea. Skipping migration. gitea-mirror | 2025-05-28T09:26:45.173148342Z Mirroring progress: 100% (1/1) gitea-mirror | 2025-05-28T09:26:45.173157841Z Successfully mirrored repository: AdminData gitea-mirror | 2025-05-28T09:26:45.193587243Z Publishing event to channel mirror-status:03b9a235-8173-49d9-8c20-e6bc0f7a8d10 for user 03b9a235-8173-49d9-8c20-e6bc0f7a8d10 gitea-mirror | 2025-05-28T09:26:45.208836715Z Event published successfully with ID fe24e990-a5b8-49c3-ae0d-4b427065a382 gitea-mirror | 2025-05-28T09:26:45.221634853Z Publishing event to channel mirror-status:03b9a235-8173-49d9-8c20-e6bc0f7a8d10 for user 03b9a235-8173-49d9-8c20-e6bc0f7a8d10 gitea-mirror | 2025-05-28T09:26:45.233752633Z Event published successfully with ID 94f6975e-db75-423f-a9a9-287c1164aae7 gitea-mirror | 2025-05-28T09:26:45.233805836Z Unregistered job: 8db03dec-b332-4407-957b-a19553632daa (0 remaining active jobs) gitea-mirror | 2025-05-28T09:26:45.233815922Z All repository mirroring tasks completed ` Its a new gitea instance without any repositorys
Author
Owner

@arunavo4 commented on GitHub (May 28, 2025):

@crocofied can you share your docker-compose file or how you are running the application. Looks like it still might have the old data base thats why it says it has found Unregistered job. If you can purge the old db file of this gitea-mirror application and start new.

<!-- gh-comment-id:2915646853 --> @arunavo4 commented on GitHub (May 28, 2025): @crocofied can you share your docker-compose file or how you are running the application. Looks like it still might have the old data base thats why it says it has found `Unregistered job`. If you can purge the old db file of this gitea-mirror application and start new.
Author
Owner

@crocofied commented on GitHub (May 28, 2025):

# Gitea Mirror deployment configuration
# Standard deployment with automatic database maintenance

services:
  gitea-mirror:
    image: ${DOCKER_REGISTRY:-ghcr.io}/${DOCKER_IMAGE:-arunavo4/gitea-mirror}:${DOCKER_TAG:-latest}
    build:
      context: .
      dockerfile: Dockerfile
      platforms:
        - linux/amd64
        - linux/arm64
      cache_from:
        - ${DOCKER_REGISTRY:-ghcr.io}/${DOCKER_IMAGE:-arunavo4/gitea-mirror}:${DOCKER_TAG:-latest}
    container_name: gitea-mirror
    restart: unless-stopped
    ports:
      - "53305:53305"
    volumes:
      - gitea-mirror-data:/app/data
    environment:
      - NODE_ENV=production
      - DATABASE_URL=file:data/gitea-mirror.db
      - HOST=0.0.0.0
      - PORT=53305
      - JWT_SECRET=${JWT_SECRET:-your-secret-key-change-this-in-production}
      # GitHub/Gitea Mirror Config
      - GITHUB_USERNAME=${GITHUB_USERNAME:-}
      - GITHUB_TOKEN=${GITHUB_TOKEN:-}
      - SKIP_FORKS=${SKIP_FORKS:-false}
      - PRIVATE_REPOSITORIES=${PRIVATE_REPOSITORIES:-false}
      - MIRROR_ISSUES=${MIRROR_ISSUES:-false}
      - MIRROR_STARRED=${MIRROR_STARRED:-false}
      - MIRROR_ORGANIZATIONS=${MIRROR_ORGANIZATIONS:-false}
      - PRESERVE_ORG_STRUCTURE=${PRESERVE_ORG_STRUCTURE:-false}
      - ONLY_MIRROR_ORGS=${ONLY_MIRROR_ORGS:-false}
      - SKIP_STARRED_ISSUES=${SKIP_STARRED_ISSUES:-false}
      - GITEA_URL=${GITEA_URL:-}
      - GITEA_TOKEN=${GITEA_TOKEN:-}
      - GITEA_USERNAME=${GITEA_USERNAME:-}
      - GITEA_ORGANIZATION=${GITEA_ORGANIZATION:-github-mirrors}
      - GITEA_ORG_VISIBILITY=${GITEA_ORG_VISIBILITY:-public}
      - DELAY=${DELAY:-3600}
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=3", "--spider", "http://localhost:4321/api/health"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 15s

# Define named volumes for database persistence
volumes:
  gitea-mirror-data:    # Database volume

This is my docker compose, I just removed the old volume with docker volume rm gitea-mirror-data before running the new application

<!-- gh-comment-id:2915669488 --> @crocofied commented on GitHub (May 28, 2025): ```yml # Gitea Mirror deployment configuration # Standard deployment with automatic database maintenance services: gitea-mirror: image: ${DOCKER_REGISTRY:-ghcr.io}/${DOCKER_IMAGE:-arunavo4/gitea-mirror}:${DOCKER_TAG:-latest} build: context: . dockerfile: Dockerfile platforms: - linux/amd64 - linux/arm64 cache_from: - ${DOCKER_REGISTRY:-ghcr.io}/${DOCKER_IMAGE:-arunavo4/gitea-mirror}:${DOCKER_TAG:-latest} container_name: gitea-mirror restart: unless-stopped ports: - "53305:53305" volumes: - gitea-mirror-data:/app/data environment: - NODE_ENV=production - DATABASE_URL=file:data/gitea-mirror.db - HOST=0.0.0.0 - PORT=53305 - JWT_SECRET=${JWT_SECRET:-your-secret-key-change-this-in-production} # GitHub/Gitea Mirror Config - GITHUB_USERNAME=${GITHUB_USERNAME:-} - GITHUB_TOKEN=${GITHUB_TOKEN:-} - SKIP_FORKS=${SKIP_FORKS:-false} - PRIVATE_REPOSITORIES=${PRIVATE_REPOSITORIES:-false} - MIRROR_ISSUES=${MIRROR_ISSUES:-false} - MIRROR_STARRED=${MIRROR_STARRED:-false} - MIRROR_ORGANIZATIONS=${MIRROR_ORGANIZATIONS:-false} - PRESERVE_ORG_STRUCTURE=${PRESERVE_ORG_STRUCTURE:-false} - ONLY_MIRROR_ORGS=${ONLY_MIRROR_ORGS:-false} - SKIP_STARRED_ISSUES=${SKIP_STARRED_ISSUES:-false} - GITEA_URL=${GITEA_URL:-} - GITEA_TOKEN=${GITEA_TOKEN:-} - GITEA_USERNAME=${GITEA_USERNAME:-} - GITEA_ORGANIZATION=${GITEA_ORGANIZATION:-github-mirrors} - GITEA_ORG_VISIBILITY=${GITEA_ORG_VISIBILITY:-public} - DELAY=${DELAY:-3600} healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=3", "--spider", "http://localhost:4321/api/health"] interval: 30s timeout: 10s retries: 5 start_period: 15s # Define named volumes for database persistence volumes: gitea-mirror-data: # Database volume ``` This is my docker compose, I just removed the old volume with `docker volume rm gitea-mirror-data `before running the new application
Author
Owner

@arunavo4 commented on GitHub (May 28, 2025):

@crocofied WHat does the UI show after you have imported your github data. does it show the repo you are trying to mirror?
also I am happy to connect and debug the issue as I am unable to recrete this on my end. you can email me on developer@arunavoray.dev with your availibility.

<!-- gh-comment-id:2915888567 --> @arunavo4 commented on GitHub (May 28, 2025): @crocofied WHat does the UI show after you have imported your github data. does it show the repo you are trying to mirror? also I am happy to connect and debug the issue as I am unable to recrete this on my end. you can email me on developer@arunavoray.dev with your availibility.
Author
Owner

@arunavo4 commented on GitHub (May 28, 2025):

@crocofied Hey I found the issue, I was able to recreate it and I will make a fix for it.

<!-- gh-comment-id:2916477569 --> @arunavo4 commented on GitHub (May 28, 2025): @crocofied Hey I found the issue, I was able to recreate it and I will make a fix for it.
Author
Owner

@arunavo4 commented on GitHub (May 28, 2025):

Hi @crocofied I have fixed this issue in verison v2.11.1 and later versions.
A script has also been added at the start of the docker to clean up exisiting repos at this state.

There was a bug in the db update step which caused this.

Let me know if this works out.

<!-- gh-comment-id:2916678517 --> @arunavo4 commented on GitHub (May 28, 2025): Hi @crocofied I have fixed this issue in verison `v2.11.1` and later versions. A script has also been added at the start of the docker to clean up exisiting repos at this state. There was a bug in the db update step which caused this. Let me know if this works out.
Author
Owner

@arunavo4 commented on GitHub (May 30, 2025):

Feel free to reopen the issue if its still persists after version v2.11.2

<!-- gh-comment-id:2921137034 --> @arunavo4 commented on GitHub (May 30, 2025): Feel free to reopen the issue if its still persists after version `v2.11.2`
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#9
No description provided.