[Bug] Preauth key generation command line #1021

Closed
opened 2025-12-29 02:27:38 +01:00 by adam · 5 comments
Owner

Originally created by @te-deum on GitHub (May 15, 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

I have a python script that create users and preauth key with the command line.
Now, I have to give a user id instead of user name. It work before the 0.26 version.

Expected Behavior

Create a preauth key for the given username.

Steps To Reproduce

Command : headscale preauthkeys create --user NewUser --expiration 2h --tags tag:connecteurs --ephemeral

Return :
Error: invalid argument "NewUser" for "-u, --user" flag: strconv.ParseUint: parsing "NewUser": invalid syntax
Usage:
headscale preauthkeys create [flags]

Aliases:
create, c, new

Flags:
--ephemeral Preauthkey for ephemeral nodes
-e, --expiration string Human-readable expiration of the key (e.g. 30m, 24h) (default "1h")
-h, --help help for create
--reusable Make the preauthkey reusable
--tags strings Tags to automatically assign to node

Global Flags:
-c, --config string config file (default is /etc/headscale/config.yaml)
--force Disable prompts and forces the execution
-o, --output string Output format. Empty for human-readable, 'json', 'json-line' or 'yaml'
-u, --user uint User identifier (ID)

invalid argument "NewUser" for "-u, --user" flag: strconv.ParseUint: parsing "NewUser": invalid syntax

Environment

- OS: Debian 12 / Docker
- Headscale version: 0.26
- Tailscale version:

Runtime environment

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

Debug information

Headscale logs :
2025-05-15T18:13:03+02:00 INF home/runner/work/headscale/headscale/hscontrol/poll.go:602 > node has connected, mapSession: 0xc000527200, chan: 0xc0003423f0 node=web01 node.id=3 omitPeers=false readOnly=false stream=true
2025-05-15T18:13:03+02:00 INF home/runner/work/headscale/headscale/hscontrol/poll.go:602 > node has connected, mapSession: 0xc000a6c300, chan: 0xc0002e41c0 node=web02 node.id=4 omitPeers=false readOnly=false stream=true

Originally created by @te-deum on GitHub (May 15, 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 I have a python script that create users and preauth key with the command line. Now, I have to give a user id instead of user name. It work before the 0.26 version. ### Expected Behavior Create a preauth key for the given username. ### Steps To Reproduce **Command :** headscale preauthkeys create --user NewUser --expiration 2h --tags tag:connecteurs --ephemeral **Return :** Error: invalid argument "NewUser" for "-u, --user" flag: strconv.ParseUint: parsing "NewUser": invalid syntax Usage: headscale preauthkeys create [flags] Aliases: create, c, new Flags: --ephemeral Preauthkey for ephemeral nodes -e, --expiration string Human-readable expiration of the key (e.g. 30m, 24h) (default "1h") -h, --help help for create --reusable Make the preauthkey reusable --tags strings Tags to automatically assign to node Global Flags: -c, --config string config file (default is /etc/headscale/config.yaml) --force Disable prompts and forces the execution -o, --output string Output format. Empty for human-readable, 'json', 'json-line' or 'yaml' -u, --user uint User identifier (ID) invalid argument "NewUser" for "-u, --user" flag: strconv.ParseUint: parsing "NewUser": invalid syntax ### Environment ```markdown - OS: Debian 12 / Docker - Headscale version: 0.26 - Tailscale version: ``` ### Runtime environment - [ ] Headscale is behind a (reverse) proxy - [x] Headscale runs in a container ### Debug information Headscale logs : 2025-05-15T18:13:03+02:00 INF home/runner/work/headscale/headscale/hscontrol/poll.go:602 > node has connected, mapSession: 0xc000527200, chan: 0xc0003423f0 node=web01 node.id=3 omitPeers=false readOnly=false stream=true 2025-05-15T18:13:03+02:00 INF home/runner/work/headscale/headscale/hscontrol/poll.go:602 > node has connected, mapSession: 0xc000a6c300, chan: 0xc0002e41c0 node=web02 node.id=4 omitPeers=false readOnly=false stream=true
adam added the stalebug labels 2025-12-29 02:27:38 +01:00
adam closed this issue 2025-12-29 02:27:39 +01:00
Author
Owner

@lionslair commented on GitHub (May 18, 2025):

I am getting the same issue

@lionslair commented on GitHub (May 18, 2025): I am getting the same issue
Author
Owner

@lionslair commented on GitHub (May 18, 2025):

solved it. use the user id not the name

@lionslair commented on GitHub (May 18, 2025): solved it. use the user id not the name
Author
Owner

@spymobilfon commented on GitHub (May 27, 2025):

Pre auth key API/CLI now uses ID over username https://github.com/juanfont/headscale/pull/2542
*from changelog https://github.com/juanfont/headscale/blob/main/CHANGELOG.md

@spymobilfon commented on GitHub (May 27, 2025): Pre auth key API/CLI now uses ID over username https://github.com/juanfont/headscale/pull/2542 *from changelog https://github.com/juanfont/headscale/blob/main/CHANGELOG.md
Author
Owner

@github-actions[bot] commented on GitHub (Aug 26, 2025):

This issue is stale because it has been open for 90 days with no activity.

@github-actions[bot] commented on GitHub (Aug 26, 2025): This issue is stale because it has been open for 90 days with no activity.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 3, 2025):

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions[bot] commented on GitHub (Sep 3, 2025): This issue was closed because it has been inactive for 14 days since being marked as stale.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1021