Skip to content

Issue: "SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON" with mediumcli on Linux Node v23 #61

Description

@ReeseArch64

Description:

When attempting to execute a command with mediumcli (as indicated by the <anonymous_script>:1 line), I'm encountering the following error:

SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
    at JSON.parse (<anonymous>)
    at Request._callback (/usr/lib/node_modules/mediumcli/lib/post.js:28:20)
    ... (rest of the stack trace)

Context:

This error suggests that mediumcli is trying to parse an HTML response (which starts with <!doctype html>) as if it were JSON. This typically happens when the API or endpoint mediumcli is trying to access doesn't return the expected JSON, but rather an HTML page (e.g., an error page, a login page, or a gateway response).

Steps to Reproduce:

  1. Execute the mediumcli <specific-command-that-caused-the-error> command (please replace <specific-command-that-caused-the-error> with the actual command you were running).

Expected Behavior:

mediumcli should successfully process the request, whether it's publishing a post, retrieving information, or any other action expected from the command.

Current Behavior:

mediumcli fails with a SyntaxError because it's receiving an HTML response instead of JSON.

Possible Causes (and suggested investigations):

  • Authentication/Session Issue: mediumcli might not be properly authenticated, leading to a redirect to an HTML login or error page. Double-check your mediumcli credentials.
  • Network/Proxy Issue: A proxy or network problem could be intercepting the request and returning an HTML error page.
  • Medium API Change: The Medium API might have changed how it returns data or the response structure, causing incompatibility with mediumcli.
  • mediumcli Bug: There might be a bug within mediumcli itself that prevents it from correctly handling certain API responses from Medium.

Additional Information:

  • Node.js Version: Node.js v23.11.1
  • Operating System: Linux
  • Location: Goiânia, Goiás, Brazil
  • Date/Time of Error: Saturday, May 25, 2025, 1:25:40 PM -03

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions