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

Error: Process completed with exit code 127 #72

Open
bvendsel opened this issue Dec 29, 2023 · 17 comments
Open

Error: Process completed with exit code 127 #72

bvendsel opened this issue Dec 29, 2023 · 17 comments

Comments

@bvendsel
Copy link

image

I keep getting this error when I try to run the automation. As shown in the instructions, I set up the secrets, but it seems to be looking for a "zotero_library_id" which wasn't one of the three. Did I miss something?

Researching the error suggests that either (a) something is missing or (b) the script doesn't have other permissions it needs to run. Option b seems unlikely so I'm stuck on the hypothesis that it is option a, but after starting from a fresh fork, replacing the secrets, and generally doing everything I can think of, I'm stuck.

@lovek323
Copy link

You will need to set ZOTERO_ID (which is your user ID from Zotero).

Your personal library ID (aka userID) can be found here next to Your userID for use in API calls is XXXXXX.

See the readme for more info.

@lovek323
Copy link

If you've correctly set ZOTERO_ID, one thing to keep in mind is that they should be repository secrets, not environment secrets.

@bvendsel
Copy link
Author

That's the thing; it is set up correctly (so far as I know) as a repository secret. I even tried updating it just now and forcing the automation to run, and it failed again. I know there must be something I'm doing wrong but I can't figure it out for the life of me.

@lovek323
Copy link

Does your configuration look like this? Can you share your version of this page?

image

@bvendsel
Copy link
Author

Of course. Here it is.

image

You can see where I updated the ID just in case.

@lovek323
Copy link

Yep, that all looks correct. Are you still getting the same error as the initial post? There are some other errors there – maybe you just need to sync your fork with the original repo to pull down any more recent commits?

@bvendsel
Copy link
Author

Another good idea, but it seems to be up to date 🤷‍♂️

image

I thought maybe it was an issue with how I configured the Zotero API key, but I updated that just now and still nothing. Not sure what else to do.

@lovek323
Copy link

Can you share the full log of the GitHub Action? One thing I did so that I could test it more easily is add the workflow_dispatch: key to the on: property in the automation.yml file, which allowed me to run it manually, so that might help you get a fresh log.

name: Zotero to Readwise Automation

on:
  push:
    branches:
      - master
  schedule:
    - cron: "0 3 * * *" # Runs at 03:00 AM (UTC) every day (Check https://crontab.guru/)
  workflow_dispatch:

@lovek323
Copy link

I think some of the secrets may be configured incorrectly based this line:

2024-02-17T21:52:37.9984231Z /home/runner/work/_temp/3607e498-e926-41e4-9756-03a475ead9da.sh: line 1: ***REDACTED***: command not found
2024-02-17T21:52:37.9986390Z /home/runner/work/_temp/3607e498-e926-41e4-9756-03a475ead9da.sh: line 1: fd4: command not found

You may also want to update your last comment as I think it contains a password or API key.

Can you share a screenshot (with a fake value in) of exactly what values you're using in the repository secrets? I suspect that there are some extra quotes or perhaps special characters like exclamation points or something like that that are interfering with your setup.

@lovek323
Copy link

In particular, this line in the automation.yml may need some more quoting or escaping.

        run: python run.py ${{ secrets.READWISE_TOKEN }} ${{ secrets.ZOTERO_KEY }} ${{ secrets.ZOTERO_ID }}

You could try changing it to

        run: python run.py "${{ secrets.READWISE_TOKEN }}" "${{ secrets.ZOTERO_KEY }}" "${{ secrets.ZOTERO_ID }}"

I am not an expert on how GitHub provides these secrets, they may already be escaped, but I suspect they aren't. This is at least where I'd look next for myself.

@bvendsel
Copy link
Author

Thanks for the heads up. I wasn't thinking when I posted that.

Checked the values. None of them include any special characters. Just letters and numbers.

I'll try updating the automation.yml with the extra quotes to see if that helps.

@lovek323
Copy link

In case it helps, here is a list of special characters in Bash:

  #   – Used to start a comment in Bash.
  ;   – Allows the execution of multiple commands on the same line.
  &   – Executes the preceding command in the background.
  |   – Passes the output of one command as input to another.
  >   – Redirects the output of a command to a file, overwriting the file if it exists.
  >>   – Appends the output of a command to the end of a file.
  <   - Redirects input from a file to a command.
  $   - Used to reference the value of a variable.
  *   - Matches any number of characters in a filename or variable.
  ?   - Matches exactly one character in a filename or variable.
  { }   - Used for brace expansion to generate arbitrary strings.
  ( )   - Executes commands in a new shell instance, also known as a subshell.
  [ ]   - Matches any one character enclosed in the brackets in a filename or variable.
  !   - Negates the exit status of the command that follows it, also used for history expansion.
  \   - Nullifies the special meaning of the next character.
  .   - Represents the current directory in a file path.
  ..   - Represents the parent directory in a file path.
  /   - Separates directories in a file path, represents the root directory when used at the start of a path.
  ~   - Represents the home directory of the current user in a file path.
  <<<   - Redirects a string into the standard input of a command.

@bvendsel
Copy link
Author

None of those are in there. Just A-Z (both cases) and 1-9.

Made the update to automation.yml and am now getting this:

Readwise: Push 553 Zotero annotations/notes to Readwise...
It may take some time depending on the number of highlights...
A complete message will show up once it's done!

Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run.py", line 73, in
zt2rw.run()
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/zotero2readwise/zt2rw.py", line 60, in run
self.readwise.post_zotero_annotations_to_readwise(formatted_items)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/zotero2readwise/readwise.py", line 149, in post_zotero_annotations_to_readwise
self.create_highlights(rw_highlights)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/zotero2readwise/readwise.py", line 71, in create_highlights
dump(resp.json(), f)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Error: Process completed with exit code 1.

@lovek323
Copy link

Bummer. At least now we've got the app running – this may be some issue with particular characters in a Zotero highlight or a text encoding issue? I'm really just guessing now. I think we've reached the limit of what I can help with without knowledge of the internals of this app.

The next step I'd suggest is trying to get it running locally. Hopefully this will give you the same error and then you'll be able to dive in and debug what's happening on your local machine.

@lovek323
Copy link

lovek323 commented Feb 17, 2024

One final thought – and this might be way off – are there any new lines in your secrets? Any blank spaces at the beginning or end? I assume GitHub simply dumps out the contents of the secret which may be causing some errors.

@bvendsel
Copy link
Author

Another good idea but nope. Updated them all to be sure.

@bvendsel
Copy link
Author

So interestingly, I tried to run the original Python script and got the following error:

zotero2readwise.exception.Zotero2ReadwiseError: Uploading to Readwise failed with following details:
POST request Status Code=400 (Bad Request)

I am trying to figure out what I could have possibly done wrong with Readwise. The other interesting thing is nothing gets written to the .json file that it supposedly writes everything to. So strange.

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

No branches or pull requests

2 participants