Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1 #85

Closed
rfay opened this issue Jun 29, 2023 · 5 comments · Fixed by #86

Comments

@rfay
Copy link

rfay commented Jun 29, 2023

In

I tried to change out the PHP CLI for the golang CLI, but I see this failure when issuing the platform command:

(platform cli is installed with curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash as you see in the PR)

Is this because there aren't any projects available? Not logged in? It's certainly not expected behavior.

rfay@d9-web:/var/www/html$ 
rfay@d9-web:/var/www/html$ platform --version
Platform.sh CLI 4.7.1
rfay@d9-web:/var/www/html$ platform version
Platform.sh CLI 4.7.1 (Wrapped)

platform
Welcome to Platform.sh!

Loading projects...

Fatal error: Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php:75
Stack trace:
#0 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Formatter/OutputFormatter.php(165): Symfony\Component\Console\Formatter\OutputFormatterStyleStack->pop(Object(Symfony\Component\Console\Formatter\OutputFormatterStyle))
#1 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/src/Application.php(395): Symfony\Component\Console\Formatter\OutputFormatter->format('<error>  form a...')
#2 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Application.php(127): Platformsh\Cli\Application->renderException(Object(Platformsh\Cli\Exception\LoginRequiredException), Object(Symfony\Component\Console\Output\StreamOutput))
#3 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Application.php(154): Symfony\Component\Console\Application->Symfony\Component\Console\{closure}(Object(Platformsh\Cli\Exception\LoginRequiredException))
#4 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/bin/platform(32): Symfony\Component\Console\Application->run()
#5 /tmp/psh-go-8.0.28-4.7.1/psh-4.7.1(10): require('phar:///tmp/psh...')
#6 {main}
  thrown in phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php on line 75
@rfay
Copy link
Author

rfay commented Jun 29, 2023

If I set PLATFORMSH_CLI_TOKEN I get different but bad behavior:

$ platform
Welcome to Platform.sh!

Your session has expired. You have been logged out.

Authentication is required.

Log in via a browser? [Y/n] n

Fatal error: Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php:75
Stack trace:
#0 phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/vendor/symfony/console/Formatter/OutputFormatter.php(165): Symfony\Component\Console\Formatter\OutputFormatterStyleStack->pop(Object(Symfony\Component\Console\Formatter\OutputFormatterStyle))
#1 phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/src/Application.php(395): Symfony\Component\Console\Formatter\OutputFormatter->format('<error>  form a...')
#2 phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/vendor/symfony/console/Application.php(127): Platformsh\Cli\Application->renderException(Object(GuzzleHttp\Exception\RequestException), Object(Symfony\Component\Console\Output\StreamOutput))
#3 phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/vendor/symfony/console/Application.php(154): Symfony\Component\Console\Application->Symfony\Component\Console\{closure}(Object(GuzzleHttp\Exception\RequestException))
#4 phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/bin/platform(32): Symfony\Component\Console\Application->run()
#5 /private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0(10): require('phar:///private...')
#6 {main}
  thrown in phar:///private/var/folders/3k/0159p4ld73jfbct7ykph9w340000gn/T/psh-go-8.0.28-4.7.0/psh-4.7.0/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php on line 75

You're welcome to experiment with this using the DDEV artifacts from ddev/ddev#5044 (comment)

I think probably the golang version is not yet ready for DDEV to switch to.

@akalipetis
Copy link
Member

Thanks for reporting @rfay - I can't reproduce this, getting DDEV from the PR and running it on Linux, I can authenticate with all methods (except the web browser, as the port is not exported by DDEV).

DDEV and Platform.sh CLI logs
(.venv) akalipetis@platformify-flask-demo-web:/var/www/html$ platform 
Welcome to Platform.sh!

Your projects are:
+---------------+---------------------------------+------------------+--------------------------------+
| ID            | Title                           | Region           | Organization                   |
+---------------+---------------------------------+------------------+--------------------------------+
[REDACTED]
+---------------+---------------------------------+------------------+--------------------------------+

Get a project by running: platform get [id]
List a project's environments by running: platform environments -p [id]

You are logged in as [REDACTED]

To view all commands, run: platform list
(.venv) akalipetis@platformify-flask-demo-web:/var/www/html$ platform version
Platform.sh CLI 4.7.1 (Wrapped)

Could you please share the system you're using? Both OS and architecture should help in order to reproduce this.

@rfay
Copy link
Author

rfay commented Jun 29, 2023

Sorry, I should have said that. This was macOS arm64/Apple Silicon, so the image is running Debian Linux/arm64.

It's easy to demonstrate with just the image:

$ docker run -it --rm ddev/ddev-webserver:20230628_use_golang_platform_cli bash
root@f54dbb56bbfc:/# platform
Welcome to Platform.sh!

Loading projects...

Fatal error: Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php:75
Stack trace:
#0 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Formatter/OutputFormatter.php(165): Symfony\Component\Console\Formatter\OutputFormatterStyleStack->pop(Object(Symfony\Component\Console\Formatter\OutputFormatterStyle))
#1 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/src/Application.php(395): Symfony\Component\Console\Formatter\OutputFormatter->format('<error>  form a...')
#2 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Application.php(127): Platformsh\Cli\Application->renderException(Object(Platformsh\Cli\Exception\LoginRequiredException), Object(Symfony\Component\Console\Output\StreamOutput))
#3 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Application.php(154): Symfony\Component\Console\Application->Symfony\Component\Console\{closure}(Object(Platformsh\Cli\Exception\LoginRequiredException))
#4 phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/bin/platform(32): Symfony\Component\Console\Application->run()
#5 /tmp/psh-go-8.0.28-4.7.1/psh-4.7.1(10): require('phar:///tmp/psh...')
#6 {main}
  thrown in phar:///tmp/psh-go-8.0.28-4.7.1/psh-4.7.1/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php on line 75
root@f54dbb56bbfc:/#

After running it and seeing the failure you can poke around in there to see what's wrong.

@rfay
Copy link
Author

rfay commented Jun 29, 2023

Same results running on amd64 linux (Ubuntu 22.04), Docker 24.0.2

Interestingly though, doesn't happen on gitpod (also amd64 Ubuntu, but gitpod has docker 23.0.3

@pjcdawkins
Copy link
Contributor

This is a bug in https://github.com/platformsh/legacy-cli

The "Incorrectly nested style tag" is caused by the naive rendering of the exception, which wraps text depending on the terminal width, and incorrectly wraps style tags, and incorrectly then tries to format all of that line by line, so for example <comment> can end up being formatted as <comm and then ent>.

And this would have been more recently revealed by platformsh/legacy-cli@42dcd20 because it adds a couple more style tags, making it more likely to happen.

So you'll get different results depending how the terminal width is set / detected. 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants