-
Couldn't load subscription status.
- Fork 233
Description
Environment
dart --version:
Dart SDK version: 3.9.0 (stable) (Mon Aug 11 07:58:10 2025 -0700) on "windows_x64"
Problem
When publishing a package to localhost with a custom port, it fails to correctly parse the domain (localhost) and somehow interprets it together with the port as an IPv6 address.
The problem can be reproduced using this repository: https://github.com/ricardoboss/pub-publish-localhost-ipv6-bug
It contains a docker-compose.yml and a dart package example.
Starting the services in the docker compose file runs a pub.dev-compatible API on localhost:8123, along with a web interface.
The package is configured to to publish to that address.
The setup also requires to create an account using the web interface in order to obtain an access token.
After obtaining the token, I used:
$env:PUBNET_TOKEN="<token>"
dart pub token add http://localhost:8123 --env-var PUBNET_TOKEN
dart pub publish
Expected behavior
I expected the publish to successfully publish.
Actual behavior
Running dart pub publish results in:
Resolving dependencies...
Downloading packages...
Got dependencies!
Publishing example 1.0.0 to http://localhost:8123:
|-- CHANGELOG.md (<1 KB)
|-- LICENSE.md (<1 KB)
|-- README.md (<1 KB)
|-- analysis_options.yaml (1 KB)
|-- bin
| '-- example.dart (<1 KB)
|-- lib
| '-- example.dart (<1 KB)
|-- pubspec.yaml (<1 KB)
'-- test
'-- example_test.dart (<1 KB)
Total compressed archive size: 1 KB.
Validating package...
Package validation found the following 2 potential issues:
* Please consider renaming .\LICENSE.md to `LICENSE`. See https://dart.dev/tools/pub/publishing#important-files.
* It's strongly recommended to include a "homepage" or "repository" field in your pubspec.yaml
Package validation found the following hint:
* You're about to publish a package that opts into null safety.
The previous version (0.0.1) isn't opted in.
See https://dart.dev/null-safety/migration-guide for best practices.
Publishing is forever; packages cannot be unpublished.
Policy details are available at https://pub.dev/policy
Package has 2 warnings and 1 hint.. Do you want to publish example 1.0.0 to http://localhost:8123 (y/N)? y
Uploading...
Illegal IPv6 address, an IPv6 part can only contain a maximum of 4 hex digits (at character 9)
http://[localhost:8123]:8123/api/storage/upload
^
dart:core Uri.parse
package:pub/src/command/lish.dart 156:31 LishCommand._publishUsingClient.<fn>
===== asynchronous gap ===========================
package:pub/src/progress.dart 61:3 Progress.stop
===== asynchronous gap ===========================
package:pub/src/command/lish.dart 137:7 LishCommand._publishUsingClient
===== asynchronous gap ===========================
package:pub/src/authentication/client.dart 128:12 withAuthenticatedClient
===== asynchronous gap ===========================
package:pub/src/command/lish.dart 264:9 LishCommand._publish
===== asynchronous gap ===========================
package:pub/src/command/lish.dart 502:7 LishCommand.runProtected
===== asynchronous gap ===========================
package:pub/src/command.dart 197:7 PubCommand.run
===== asynchronous gap ===========================
package:args/command_runner.dart 212:13 CommandRunner.runCommand
===== asynchronous gap ===========================
package:dartdev/dartdev.dart 255:18 DartdevRunner.runCommand
===== asynchronous gap ===========================
package:dartdev/dartdev.dart 48:16 runDartdev
===== asynchronous gap ===========================
C:\b\s\w\ir\x\w\sdk\pkg\dartdev\bin\dartdev.dart 13:5 main
This is an unexpected error. The full log and other details are collected in:
C:\Users\<username>\AppData\Local\Pub\Cache\log\pub_log.txt
Consider creating an issue on https://github.com/dart-lang/pub/issues/new
and attaching the relevant parts of that log file.
The http://[localhost:8123]:8123 looks very suspicious and like a bug somewhere in the pub client.
--verbose output
The mentioned log file (with --verbose enabled) is attached: