Skip to content

[Bug]: Solidity: an import with ../ points at a dangling stub instead of the real file #4984

Closed

Description

@rohit-jsfreaky

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

A Solidity import that goes up a folder (import {Errors} from "../utils/Errors.sol";) gets an imports_from edge to a node that does not exist. The path is joined to the importer's folder without being normalised, so from contracts/proxy/Clones.sol the target becomes contracts/proxy/utils/errors.sol instead of contracts/utils/Errors.sol. That dangling target's id also keeps the absolute checkout path (e.g. c_users_..._contracts_proxy_utils_errors_sol), so graph.json is not portable.

Because the import never reaches the real file, everything that resolves names through imports (type references, and qualified names like Errors.FailedCall) cannot see the imported file.

On OpenZeppelin Contracts v5.4.0, only 87 of 681 Solidity imports_from edges reach a real file; the other 594 (every ../ import) dangle.

Steps to reproduce

mkdir -p contracts/utils contracts/proxy
echo 'library Errors { error FailedCall(); }' > contracts/utils/Errors.sol
printf 'import {Errors} from "../utils/Errors.sol";\nlibrary Clones { function clone() internal {} }\n' > contracts/proxy/Clones.sol
graphify update .

Then look at the imports_from edge from Clones.sol in graphify-out/graph.json.

Error output or graph output

imports_from Clones.sol -> c_users_..._contracts_proxy_utils_errors_sol   (no such node; no source_file)

Expected: imports_from Clones.sol -> contracts_utils_errors_sol (the real Errors.sol file node).

Graphify version

0.9.101 (v8 @ 8e6a6d2)

Operating System

Windows

Python Version

3.12

Installation Method

uv tool install (recommended)

Activity

  1. github-actions commented on Nov 3, 2026

    @github-actions

    Thanks for opening this issue, @rohit-jsfreaky. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Nov 3, 2026

    @safishamsi
    Member

    Fixed in 0.9.102 (published to PyPI) via #4985. A Solidity import with ../ resolves the .. to the real file instead of a dangling id.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions