[Bug] v0.27.0 crashes during v0.26.1 policy parsing #1119

Closed
opened 2025-12-29 02:28:21 +01:00 by adam · 2 comments
Owner

Originally created by @YouSysAdmin on GitHub (Oct 27, 2025).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

During the upgrade from v0.26.1 to v0.27.0 Headscale crashes during the policy loading stage.

Error:

creating new headscale: init state: init policy manager: parsing policy: parsing policy from bytes: json: cannot unmarshal JSON object into Go v2.Groups within \"/groups\": Group \"group:network-example\" value must be an array of users, got <nil>

Policy (in db):

"groups": {
    "group:network-example": null,
    ...
}

Expected Behavior

Correct policy parsing, as in v0.26.1

It's very good to retain support for empty groups, which makes administration much easier.

Steps To Reproduce

  1. Use version 0.26.1 to initialize the database.
  2. Apply a policy with empty groups.
  3. Upgrade to version 0.27.0.

Environment

- OS: Linux Debian 12
- Headscale version: 0.27.0
- Tailscale version: -

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Debug information

Originally created by @YouSysAdmin on GitHub (Oct 27, 2025). ### Is this a support request? - [x] This is not a support request ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior During the upgrade from v0.26.1 to v0.27.0 Headscale crashes during the policy loading stage. Error: ``` creating new headscale: init state: init policy manager: parsing policy: parsing policy from bytes: json: cannot unmarshal JSON object into Go v2.Groups within \"/groups\": Group \"group:network-example\" value must be an array of users, got <nil> ``` Policy (in db): ``` "groups": { "group:network-example": null, ... } ``` ### Expected Behavior Correct policy parsing, as in v0.26.1 It's very good to retain support for empty groups, which makes administration much easier. ### Steps To Reproduce 1. Use version 0.26.1 to initialize the database. 2. Apply a policy with empty groups. 3. Upgrade to version 0.27.0. ### Environment ```markdown - OS: Linux Debian 12 - Headscale version: 0.27.0 - Tailscale version: - ``` ### Runtime environment - [ ] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ### Debug information -
adam added the bug label 2025-12-29 02:28:21 +01:00
adam closed this issue 2025-12-29 02:28:21 +01:00
Author
Owner

@YouSysAdmin commented on GitHub (Oct 27, 2025):

If replace null to [] in policy

"groups": {
    "group:network-example":[],
    ...
}

This works well, but this behavior is not standard for most libraries, so I had to make the sanitize patch for the behavior of the Go std lib. :)
https://github.com/YouSysAdmin/headscale-pf/pull/10/files

@YouSysAdmin commented on GitHub (Oct 27, 2025): If replace `null` to `[]` in policy ``` "groups": { "group:network-example":[], ... } ``` This works well, but this behavior is not standard for most libraries, so I had to make the sanitize patch for the behavior of the Go std lib. :) https://github.com/YouSysAdmin/headscale-pf/pull/10/files
Author
Owner

@kradalby commented on GitHub (Oct 27, 2025):

I was just about to suggest it. This will be the way forward. There should not be null in the policy.

@kradalby commented on GitHub (Oct 27, 2025): I was just about to suggest it. This will be the way forward. There should not be `null` in the policy.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1119