aicommits
aicommits copied to clipboard
✖ TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)
Bug description
When i trying to turning on hook using command "aicommits hook install" and add file to commit, then commit it, return error like this
`> git -c user.useConfigOnly=true commit --quiet
[90m┌[39m aicommits
[?25l[90m│[39m
[35m○[39m Detecting staged files
[999D[1A[35m◒[39m Detecting staged files
[999D[1A[35m◐[39m Detecting staged files
[999D[1A[35m◓[39m Detecting staged files
[999D[1A[35m◑[39m Detecting staged files
[999D[1A[35m◒[39m Detecting staged files
[999D[1A[35m◐[39m Detecting staged files
[999D[1A[35m◓[39m Detecting staged files
[999D[1A[35m◑[39m Detecting staged files
[999D[1A[35m◒[39m Detecting staged files.
[999D[1A[35m◐[39m Detecting staged files.
[999D[1A[35m◓[39m Detecting staged files.
[999D[2A[J[J[90m│[39m
[32m◇[39m Detected 1 staged file:
app/Http/Controllers/FormatA2Controller.php
[?25h[?25l[90m│[39m
[35m○[39m The AI is analyzing your changes
[999D[1A[35m◒[39m The AI is analyzing your changes
[999D[1A[35m◐[39m The AI is analyzing your changes
[999D[1A[35m◓[39m The AI is analyzing your changes
[999D[1A[35m◑[39m The AI is analyzing your changes
[999D[1A[35m◒[39m The AI is analyzing your changes
[999D[1A[35m◐[39m The AI is analyzing your changes
[999D[1A[35m◓[39m The AI is analyzing your changes
[999D[1A[35m◑[39m The AI is analyzing your changes
[999D[1A[35m◒[39m The AI is analyzing your changes.
[999D[1A[35m◐[39m The AI is analyzing your changes.
[999D[1A[35m◓[39m The AI is analyzing your changes.
[999D[1A[35m◑[39m The AI is analyzing your changes.
[999D[1A[35m◒[39m The AI is analyzing your changes.
[999D[1A[35m◐[39m The AI is analyzing your changes.
[999D[1A[35m◓[39m The AI is analyzing your changes.
[999D[1A[35m◑[39m The AI is analyzing your changes.
[999D[1A[35m◒[39m The AI is analyzing your changes..
[999D[1A[35m◐[39m The AI is analyzing your changes..
[999D[1A[35m◓[39m The AI is analyzing your changes..
[999D[1A[35m◑[39m The AI is analyzing your changes..
[999D[1A[35m◒[39m The AI is analyzing your changes..
[999D[1A[35m◐[39m The AI is analyzing your changes..
[999D[1A[35m◓[39m The AI is analyzing your changes..
[999D[1A[35m◑[39m The AI is analyzing your changes..
[999D[1A[35m◒[39m The AI is analyzing your changes...
[999D[2A[J[J[90m│[39m
[32m◇[39m Changes analyzed
[?25h[90m│[39m
[90m└[39m ✖ TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)
at new SystemError (node:internal/errors:238:5)
at new NodeError (node:internal/errors:349:7)
at new WriteStream (node:tty:94:11)
at Ei.prompt (file:///C:/Users/nurar/AppData/Roaming/npm/node_modules/aicommits/dist/cli.mjs:29:700)
at vi (file:///C:/Users/nurar/AppData/Roaming/npm/node_modules/aicommits/dist/cli.mjs:39:7)
at file:///C:/Users/nurar/AppData/Roaming/npm/node_modules/aicommits/dist/cli.mjs:68:368
at processTicksAndRejections (node:internal/process/task_queues:96:5)
aicommits v1.5.0
Please open a Bug report with the information above:
https://github.com/Nutlope/aicommits/issues/new/choose
`
Can u help me for this error?
aicommits version
1.5.0
Environment
System:
OS: Windows 10 10.0.22621
CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Memory: 626.66 MB / 7.85 GB
Binaries:
Node: 16.17.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
Can you contribute a fix?
- [ ] I’m interested in opening a pull request for this issue.
Likely this check is failing on Windows: https://github.com/Nutlope/aicommits/blob/1b01c2d95aef89cbff0fd191db944dd892c087aa/src/commands/hook.ts#LL13C36-L13C51
Will take a look soon.
— ✖ TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor) at new SystemError (node:internal/errors:233:5) at new NodeError (node:internal/errors:336:7) at new WriteStream (node:tty:94:11) at Ei.prompt (file:///C:/Users/dd/AppData/Roaming/npm/node_modules/aicommits/dist/cli.mjs:29:700) at vi (file:///C:/Users/dd/AppData/Roaming/npm/node_modules/aicommits/dist/cli.mjs:39:7) at file:///C:/Users/dd/AppData/Roaming/npm/node_modules/aicommits/dist/cli.mjs:68:368 at processTicksAndRejections (node:internal/process/task_queues:96:5) aicommits v1.5.0
Only happen with hook set
Just to contribute helping the wanderer :
- I had a very similar isue running an npx command to setup
gluestack-ui
in my project, see loggs below - I googled, other similar commands do fail with very similar error
- the problem is with git bash (and it probably is caused because of unix slash windows antislash oppositions, I thnk that because of both next bullet point, and because i found mentioned above, https://github.com/Nutlope/aicommits/blob/1b01c2d95aef89cbff0fd191db944dd892c087aa/src/commands/hook.ts#LL13C36-L13C51 :
- look at the code, it's got a hardcoded slash character, and well it oblviously is a filesystem path, which i believe is valued with slash paths from git bash, but well the glustack-ui instalation process executes other commands, using those paths, but without git bash as execution context
- where i found exact same kind of error (here they try and create a svelte app) : https://stackoverflow.com/questions/75750730/cannot-create-sveltekit-app-err-tty-init-failed-uv-tty-init-returned-ebadf-ba
- quick workaround: i used the vscode terminal, it worked. I read it also works using powershell, both of which would confirm the issue is about directory paths
- better worksaround : use WSL2
- deeper workaround : could we think of any ? I don't have any yet, i just bear in mind the question
My error logs
$ npx gluestack-ui@latest init
T gluestack-ui
|
o Repository already cloned.
|
o Git pull successful.
|
x Error: TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)
|
* gluestack-ui initialization completed!
node:internal/errors:477
ErrorCaptureStackTrace(err);
^
SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)
at new SystemError (node:internal/errors:239:5)
at new NodeError (node:internal/errors:350:7)
at new WriteStream (node:tty:93:11)
at ConfirmPrompt.prompt (C:\Users\Utilisateur\AppData\Local\npm-cache\_npx\4d3bda48cf361d69\node_modules\@clack\core\dist\index.cjs:9:766)
at confirm (C:\Users\Utilisateur\AppData\Local\npm-cache\_npx\4d3bda48cf361d69\node_modules\@clack\prompts\dist\index.cjs:22:7)
at C:\Users\Utilisateur\AppData\Local\npm-cache\_npx\4d3bda48cf361d69\node_modules\gluestack-ui\dist\utils.js:76:64
at Generator.next (<anonymous>)
at C:\Users\Utilisateur\AppData\Local\npm-cache\_npx\4d3bda48cf361d69\node_modules\gluestack-ui\dist\utils.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\Utilisateur\AppData\Local\npm-cache\_npx\4d3bda48cf361d69\node_modules\gluestack-ui\dist\utils.js:3:12) {
code: 'ERR_TTY_INIT_FAILED',
info: {
errno: -4083,
code: 'EBADF',
message: 'bad file descriptor',
syscall: 'uv_tty_init'
},
errno: [Getter/Setter],
syscall: [Getter/Setter]
}
Node.js v18.4.0
I had a problem running it with a Git Bash. Just use cmd (native terminal) in windows, everything should be fine.
I had a problem running it with a Git Bash. Just use cmd (native terminal) in windows, everything should be fine.
Worked for me. Thanks!
Tanks man! 🙏 @airDjura