Skip to main content

Forgejo write failed

typehttps://docs.frem.sh/reference/api/errors/forgejo-write-failed
HTTP status502 Bad Gateway

What it means

You asked fremforge to apply the default risk policy (POST /orgs/{org}/risk-tier/template/apply), and Forgejo refused to write .fremforge/risk.yaml to the policy repository for a reason other than branch protection. A protected default branch is not an error in itself: fremforge then puts the file on a branch fremforge/risk-template and opens a pull request. This error also comes when that fallback fails, because the branch could not be written or the pull request could not be opened. The risk tier settings are not changed.

Example detail messages returned with this error:

  • Could not write .fremforge/risk.yaml to acme/.rules.
  • main of acme/.rules is protected, and the template could not be written on fremforge/risk-template.
  • main of acme/.rules is protected, and the pull request for fremforge/risk-template could not be opened.

What to do

Read detail: it names the repository and the branch. Check that the policy repository exists, is not archived or a mirror, and has a default branch, and that no rule of yours stops a branch fremforge/risk-template from being created there. Then try again. The apply is safe to repeat: it never writes the file twice, and a fremforge/risk-template branch left by an earlier attempt is reused when it already carries the template.

Response shape

All fremforge API errors are RFC 9457 problem+json:

{
  "type": "https://docs.frem.sh/reference/api/errors/forgejo-write-failed",
  "title": "Bad Gateway",
  "status": 502,
  "detail": "..."
}

Branch on type, not on title or detail - those are human-readable and may be reworded.