transifex / cli

The Transifex command-line client
Apache License 2.0
67 stars 25 forks source link

divide by 0 error during bootstrap (Intel Mac, GitHub release download) #207

Open restena-sw opened 10 months ago

restena-sw commented 10 months ago

This happens with the Github-downloaded binary on an Intel Mac:

swinter@Stefans-MacBook-Pro tx-darwin-amd64 % ./tx init

Successful creation of '.tx/config' file
swinter@Stefans-MacBook-Pro tx-darwin-amd64 % ./tx pull
API token not found. Please provide it and it will be saved in '~/.transifexrc'.
If you don't have an API token, you can generate one in https://app.transifex.com/user/settings/api/
> 1/...
# Getting info about resources

panic: runtime error: integer divide by zero

goroutine 1 [running]:
github.com/transifex/cli/pkg/worker_pool.makeProgressBar(0x0, 0x0, 0xc00006c720, 0xc0001d2b00)
    /home/runner/work/cli/cli/pkg/worker_pool/main.go:249 +0x217
github.com/transifex/cli/pkg/worker_pool.(*Pool).Start(0xc0001d2b00)
    /home/runner/work/cli/cli/pkg/worker_pool/main.go:228 +0x325
github.com/transifex/cli/internal/txlib.PullCommand(0xc0001d4490, 0xc0001066c0, 0xc0001c6460, 0x0, 0x0)
    /home/runner/work/cli/cli/internal/txlib/pull.go:64 +0x41d
github.com/transifex/cli/cmd/tx.Main.func5(0xc0001d2980, 0x14, 0x28)
    /home/runner/work/cli/cli/cmd/tx/main.go:618 +0xd79
github.com/urfave/cli/v2.(*Command).Run(0xc0001c4000, 0xc0001d2180, 0x0, 0x0)
    /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x4dd
github.com/urfave/cli/v2.(*App).RunContext(0xc00007ba00, 0x1755dc0, 0xc000026080, 0xc00001e040, 0x2, 0x2, 0x0, 0x0)
    /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x810
github.com/urfave/cli/v2.(*App).Run(...)
    /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
github.com/transifex/cli/cmd/tx.Main()
    /home/runner/work/cli/cli/cmd/tx/main.go:1055 +0x2cfa
main.main()
    /home/runner/work/cli/cli/main.go:5 +0x25
Socolin commented 8 months ago

I got the same, fixed by manually providing the config file with at least 1 resource

rffontenelle commented 5 months ago

This panic: runtime error: integer divide by zero seems to happen when .tx/config has zero resources.

It would be nice to have a better, more descriptive message.