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

(wrong-type-argument stringp nil) error when cloning a package during doom {install,upgrade} #5918

Open
javahippie opened this issue Dec 20, 2021 · 15 comments
Labels
faq Comes up frequently, and is likely answered in the FAQ (or should be) is:upstream Originates from outside the project and cannot be fully addressed here re:networking Has to do with connection issues or proxies re:straight To do with straight; our package manager
Milestone

Comments

@javahippie
Copy link

javahippie commented Dec 20, 2021

What did you expect to happen?

When running doom upgrade, I'd expect my packages to be upgraded to the latest version.

What actually happened?

Instead I receive the following error:

./doom sync                              
> Installing straight...
  > Cloning use-package...
> Executing 'doom sync' with Emacs 27.2 at 2021-12-20 09:33:45
  > Synchronizing your config with Doom Emacs...
    > Regenerating envvars file at "~/.emacs.d/.local/env"
      ✓ Successfully generated "~/.emacs.d/.local/env"
    x There was an unexpected error
      Message: Wrong type argument
      Error: (wrong-type-argument stringp nil)
      Backtrace:
        (string-match "^.*/\\(.+\\)\\.git$" nil)
        (if (string-match regexp repo) (progn (match-string 1 repo)))
        (let ((regexp "^.*/\\(.+\\)\\.git$")) (if (string-match regexp repo) (prog...
        (if host (replace-regexp-in-string "^.+/" "" repo) (let ((regexp "^.*/\\(....
        (let* ((--cl-rest-- recipe) (repo (car (cdr (plist-member --cl-rest-- ':re...
        (straight-vc-git-local-repo-name (:files ("graphql" "code-review*.el") :pa...
        (apply straight-vc-git-local-repo-name (:files ("graphql" "code-review*.el...
        (let ((func (intern (format "straight-vc-%S-%S" type method)))) (if (fboun...
        (straight-vc local-repo-name git (:files ("graphql" "code-review*.el") :pa...
        (let* ((--cl-rest-- recipe) (type (car (cdr (plist-member --cl-rest-- ':ty...
    ! Extended backtrace logged to ~/.emacs.d/.local/doom.error.log

The error log can be found here: https://pastebin.com/VQQR8R0N

doom upgrade works as expected when removing the magit entry from init.el

Describe your attempts to resolve the issue

I tried removing repositories I assumed affected with rm -rf ~/.emacs.d/.local/straight/repos/..., but the error persisted.

Reinstalling Doom Emacs entirely worked in the end.

Steps to reproduce

  • Enable the magit entry in init.el
  • Run doom upgrade, doom sync or doom install

System Information

https://pastebin.com/4wRMAQJn

@javahippie javahippie added is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet labels Dec 20, 2021
@chaoflow
Copy link

With emacsPgtkGcc 29.0.50 I had the same issue and resolved by commenting magit, running doom sync, uncommenting magit, and re-running doom sync.

@liny01-nbsa

This comment was marked as duplicate.

@mjsteinbaugh

This comment was marked as duplicate.

@mjsteinbaugh

This comment was marked as off-topic.

@chaoflow

This comment was marked as duplicate.

@korkeala

This comment was marked as duplicate.

@gregkerr

This comment was marked as duplicate.

@josh-spatial

This comment was marked as duplicate.

@hlissner hlissner added is:upstream Originates from outside the project and cannot be fully addressed here status:confirmed Issue was verified, or request approved. Waiting for a working solution. faq Comes up frequently, and is likely answered in the FAQ (or should be) re:networking Has to do with connection issues or proxies re:straight To do with straight; our package manager and removed is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet labels Feb 3, 2022
@hlissner
Copy link
Member

hlissner commented Feb 3, 2022

Unfortunately, this is not a Doom issue. This is the error that straight throws when a connection times out due to internet downtime, prohibitive proxies (or ISPs), SSL verification issues, or the remote service being down. This causes a git clone to fail silently, but still return a zero exit code. As far as straight is concerned, the clone finished successfully. Then it fails hard when it tries to read metadata from a nonexistent repo. It's not a helpful message, for sure, and should be reported and resolved upstream.

This is one of our more commonly reported issues, so I'll pin this and leave it open until it's addressed upstream, or I get around to writing an error handling layer over straight (which is a long term goal, given it's one of this project's biggest UX issues -- this is not the only error of its kind -- but it'll be some time until I get to it).

Anyhow, the workaround is to simply try again after deleting the local package's repo:

rm -rf ~/.emacs.d/.local/straight/repos/{PACKAGE-NAME}
doom sync

Cycling a package's module (comment it out in $DOOMDIR/init.el, run doom sync, uncomment it, doom sync again) will accomplish the same thing.


Side note: please use the 👍 reaction to express that their advice worked for you, instead of spamming the thread with "worked for me too!" posts.

@hlissner hlissner changed the title doom upgrade or doom sync failing with "Wrong type argument" when requiring magit (wrong-type-argument stringp nil) error when cloning a package during doom {install,upgrade} Feb 3, 2022
@hlissner hlissner pinned this issue Feb 3, 2022
@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the stale No response, forgotten, or abandoned label May 3, 2022
@hlissner hlissner added this to the v3.0 milestone May 3, 2022
@hlissner hlissner removed stale No response, forgotten, or abandoned status:confirmed Issue was verified, or request approved. Waiting for a working solution. labels May 3, 2022
@jazzpi
Copy link

jazzpi commented May 11, 2022

Is there any way to figure out what repo to delete? I ended up deleting the entire repos directory, which worked, but took a while to reinstall everything. (Sidenote: the command should probably reference .../repos/{PACKAGE-NAME} instead of .../repo/{PACKAGE-NAME})

@twlz0ne
Copy link

twlz0ne commented Jul 1, 2022

Is there any way to figure out what repo to delete?

$ rg 'straight-vc-%S-%S' .local/straight/repos/
.local/straight/repos/straight.el/straight.el
1300:  (let ((func (intern (format "straight-vc-%S-%S"

@lel4866
Copy link

lel4866 commented Sep 17, 2022

I also just ran into this error when trying to do a fresh install of doom emacs on WSL Ubuntu 22.04 LTS.

image

For me, the problem was after doing the git clone, the scripts in .emacs.d had Windows line endings.

I just ran dos2unix on them, then ran doom install, and it worked.

image

@gagbo
Copy link
Member

gagbo commented Nov 27, 2022

I'll be deleting all the comments here that are related to #6960 and not to the issue here. It is quite messy to have people talking about another issue here, and that prevents following possible solutions to the issue here (which is related to network error handling during straight operations mostly).

There are things happening in the background about #6960, it'll be fixed soon ™️ once maintainers have a bit more time, and the permanent fix to #6960 is modifying your own packages.el to repin straight

(The other reason for deletion is that people using github search for the wrong issue will come here, and think that they are on topic while commenting here, on which they − unknowingly − are not)

@doomemacs doomemacs deleted a comment from indradhanush Nov 27, 2022
@doomemacs doomemacs deleted a comment from whiskeywrangler Nov 27, 2022
@doomemacs doomemacs deleted a comment from tealsnow Nov 27, 2022
@doomemacs doomemacs deleted a comment from PlaneTraveller Nov 27, 2022
@doomemacs doomemacs deleted a comment from AgrYpn1a Nov 27, 2022
@doomemacs doomemacs deleted a comment from dmorady1 Nov 27, 2022
@doomemacs doomemacs deleted a comment from centuryx476 Nov 27, 2022
@agarciamontoro
Copy link

In case this information is useful for someone else:
I'm seeing the same error with emacs 28.2, and the same solution worked for me: rm the affected directory, run doom sync again, repeat with all failing packages until it finishes successfully.
The only thing that was different in my situation, and the reason why I'm writing this comment, is that I was seeing this:

  x There was an unexpected runtime error
    Message: Wrong type argument
    Details: (arrayp nil)
    Backtrace:
      (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" nil)
      (shell-quote-argument nil)
      (mapconcat shell-quote-argument ("git" "branch" "-m" nil) " ")
      (format "$ cd %s\n$ %s\n\n" (shell-quote-argument (expand-file-name directory)) (mapconcat #'shell-quote-argument (cons program args) " "))
      (propertize (format "$ cd %s\n$ %s\n\n" (shell-quote-argument (expand-file-name directory)) (mapconcat #'shell-quote-argument (cons program args) " ")) 'face 'straight-process-command)
      (concat (propertize (format "$ cd %s\n$ %s\n\n" (shell-quote-argument (expand-file-name directory)) (mapconcat #'shell-quote-argument (cons program args) " ")) 'face 'straight-process-command) (if...
      (let* ((inhibit-read-only t) (entry (concat (propertize (format "$ cd %s\n$ %s\n\n" (shell-quote-argument (expand-file-name directory)) (mapconcat #'shell-quote-argument (cons program args) " ")) ...
      (let* ((result result) (exit (car result)) (invoked (numberp exit)) (success (and invoked (= 0 exit))) (failure (not success)) (stdout (nth 1 result)) (stderr (nth 2 result))) (ignore result exit ...
      (let ((program x53) (args x55) (result x57) (directory x59)) (let* ((result result) (exit (car result)) (invoked (numberp exit)) (success (and invoked (= 0 exit))) (failure (not success)) (stdout ...
      (progn (ignore (null x60)) (let ((program x53) (args x55) (result x57) (directory x59)) (let* ((result result) (exit (car result)) (invoked (numberp exit)) (success (and invoked (= 0 exit))) (fail...
      (let* ((x59 (car-safe x58)) (x60 (cdr-safe x58))) (progn (ignore (null x60)) (let ((program x53) (args x55) (result x57) (directory x59)) (let* ((result result) (exit (car result)) (invoked (numbe...
      (progn (ignore (consp x58)) (let* ((x59 (car-safe x58)) (x60 (cdr-safe x58))) (progn (ignore (null x60)) (let ((program x53) (args x55) (result x57) (directory x59)) (let* ((result result) (exit (...

That is, instead of (stringp nil) in Details, I was getting (arrayp nil).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq Comes up frequently, and is likely answered in the FAQ (or should be) is:upstream Originates from outside the project and cannot be fully addressed here re:networking Has to do with connection issues or proxies re:straight To do with straight; our package manager
Projects
Status: Ready
Status: Ready
Development

No branches or pull requests