Skip to content
This repository was archived by the owner on Nov 16, 2026. It is now read-only.
This repository was archived by the owner on Nov 16, 2026. It is now read-only.

[BUG] Cannot read properties of undefined (reading 'start') #3

Closed

Description

@gaurav-nelson

Describe the bug
First, thank you for making this.

As for the issue, while running linkspector check on a json file, I am getting the following error:

💥 Error: Cannot read properties of undefined (reading 'start')

To Reproduce
Running linkspector check with the following minimal json file causes it for me:

{
    "images": [
        "https://cdn.britannica.com/75/178475-050-E9212E3D/Pyramid-of-Khufu-Giza-Egypt.jpg"
    ]
}

The issue does not happen when I remove the array and just have "images": "..." directly.

Expected behavior
I would expect this to work, but a better error message to give a better idea of what the actual issue is, or at least a line number pointing to the offending link, would be nice too.


I'm also experiencing this in a totally normal Markdown file and I have absolutely no idea why. This is the most I get:

Image

I'm really loving linkinspector otherwise. Thanks so much for your hard work on this!


I was facing the same error message on some of my repositories and after some debugging I found the root cause: a wrong link structure.

In some of the files I have the following content:

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders
responsible for enforcement at [info@example.org]. All complaints will be reviewed and investigated promptly
and fairly.

The link to the email address was not fully completed, missed the ( and ). Changing the structure to the right pattern [info@example.org](info@example.org) the execution of the linkspector is successfull.

It seems that there is a side corner scenario for wrong link patterns not evaluated by linkspector. It could be great to check it instead of this current annoying error.

Activity

  1. fullsend-ai-triage commented on Nov 13, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 6:15 AM UTC · Completed 6:23 AM UTC

    Commit: 4fe27f4 · View workflow run →

    Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $0.49

  2. fullsend-ai-triage commented on Nov 13, 2026

    @fullsend-ai-triage

    Triage Analysis

    Root Cause

    In lib/extract-markdown-hyperlinks.js (line 32), the AST visitor checks whether a link line is disabled:

    } else if (!isDisabled(node.position.start.line)) {

    Remark AST nodes generated in certain contexts (such as autolink literals within bracketed references or JSON arrays parsed as markdown) do not always have a position object defined. Attempting to access node.position.start throws TypeError: Cannot read properties of undefined (reading 'start'), crashing the process.

    Recommended Fix

    1. In lib/extract-markdown-hyperlinks.js, guard the position check with optional chaining:
      } else if (!node.position?.start?.line || !isDisabled(node.position.start.line)) {
    2. In lib/get-disabled-lines.js (line 34), guard node.position?.start?.line with optional chaining as well.
    3. Ensure downstream position handling in lib/update-linkstatus-obj.js continues to provide default position values when node.position is absent.

    Proposed Test Case

    describe('handling nodes without position metadata', () => {
      it('should not throw when extracting links from bracketed references or JSON array links', () => {
        const markdownWithBracketedLink = 'Contact at [info@example.org] for support.'
        expect(() => extractMarkdownHyperlinks(markdownWithBracketedLink, {})).not.toThrow()
    
        const jsonSnippet = '{\n  "images": [\n    "https://example.com/image.jpg"\n  ]\n}'
        expect(() => extractMarkdownHyperlinks(jsonSnippet, {})).not.toThrow()
      })
    })

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  3. fullsend-ai-coder commented on Nov 13, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 6:24 AM UTC · Completed 6:43 AM UTC

    Commit: 4fe27f4 · View workflow run →

    Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $1.15

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

    bugSomething isn't workingready-to-codeTriggers code agent dispatch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions