Skip to content

[Bug]: xcprojformatter prints redundant/non-helpful information after a decode failure #27

Open

Description

@deccylol

Describe the bug

The help text doesn't help you fix the problem that the project wasn't able to be decoded, so it shouldn't print. Only Missing required value for key “name” at “/targets[0]” should print.

Steps to reproduce

$ xcrun xcodeproj init template.xcodeproj
$ xcrun xcodeproj target add Main --product-type application
...
$ xcrun xcprojformatter --update template.xcodeproj
# add a structural issue
$ sed -i '' '/^ *"name": "Main",$/d' /tmp/xc2/template.xcodeproj/project.xcproj
$ xcrun xcprojformatter --update template.xcodeproj
Missing required value for key “name” at “/targets[0]”

----------------------------

The xcprojformatter tool pretty prints 'project.xcproj' Xcode project files in their canonical format. 

Usage:

    xcprojformatter [[--input] input-project] [--output output-project]
...

Expected behavior

No help text.

Activity

  1. added
    bug
    on Nov 15, 2026
  2. akhil9tiet commented on Nov 15, 2026

    @akhil9tiet

    I'd like to work on this — please assign it to me.

  3. zachshallbetter commented on Nov 24, 2026

    @zachshallbetter

    Hit this same issue on main (0a7242a). Right now Sources/Tool/main.swift wraps everything in one do/catch, so decode and file errors end up printing the separator and full --help text too.

    Since there wasn't a PR open for it yet, I put up a fix in #31 that separates Arguments parsing into its own do/catch and adds a few tests for decode and file errors. Let me know if you'd prefer anything formatted differently on stderr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions