Skip to content

dart pub publish --dry-run returns exit code 65 on warnings, while actual publish succeeds (exit 0) #4696

@MobiliteDev

Description

@MobiliteDev

Environment

  • Dart/Flutter version :
Flutter 3.32.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision fcf2c11572 (4 months ago) • 2025-06-24 11:44:07 -0700
Engine • revision dd93de6fb1 (4 months ago) • 2025-06-24 07:39:37 -0700
Tools • Dart 3.8.1 • DevTools 2.45.1
  • OS kind and version : windows 11 26100.6899

Problem

There is an inconsistency between the dry run return code and whether or not the publish can actually be performed. When warnings appears, dart pub publish --dry-run produces an exit code > 0 (65) while actual publishing doesn't, the package is published.

This causes me a problem for CI. I am trying to find out if my package can actually be published, based on the dry-run error code.

Expected behavior

The exit code of the --dry-run should reflect whether the package can actually be published or not. If the real publish would succeed, the dry-run should return 0.

Actual behavior

--dry-run exit code is 65 but actual publish works with exit code 0.

Step to reproduce

  • Create a new package
  • Publish version 1.0.0 (preferably on a custom hosted pub)
  • Change version of pubspec to 0.0.2 (or any version < 1.0.0), this causes a warning.
  • Run :
dart pub publish --dry-run
echo %ERRORLEVEL%   # or check $LASTEXITCODE on PowerShell
  • Observe exit code 65 with warnings only.
  • Run real publish:
dart pub publish
echo %ERRORLEVEL%   # or check $LASTEXITCODE on PowerShell
  • Observe exit code 0 and success.

Questions :

  • Am i missing something or doing something wrong ?
  • Is returning 65 on warnings in dry-run intended?
    If yes, could we get a flag to treat warnings as success (--no-fatal-warnings / --fatal-warnings) so CI can rely on dry-run?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions