Skip to content

Gitea Forge 500 Error Bug With Forgejo Instance #749

@pseudoseed

Description

@pseudoseed

Gitea forge: labels.map is not a function crash in Tower overview

Summary

Tower overview returns HTTP 500 when the forge provider is gitea. The root cause is parseLabelDefaults() in
lib/github.js calling labels.map() on a null/empty-string value.

Forgejo/Gitea issues that have no labels return labels: "" (or null from the API), but parseLabelDefaults()
assumes labels is always an Array<{name: string}> (the GitHub format).

Reproduction

  1. codev init or codev adopt with forge.provider: "gitea" pointing at a Forgejo instance
  2. Create at least one issue on the repo (no labels)
  3. Open Tower → Work tab
  4. Result: Failed to load overview: Failed to fetch overview: 500
  5. Server-side error: {"error":"labels.map is not a function"}

Possible Fix

One-line guard in parseLabelDefaults() (lib/github.ts):

 export function parseLabelDefaults(labels, title) {
-    const names = labels.map(l => l.name);
+    const names = (labels || []).map(l => l.name);

Affected version
`v3.0.3`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions