question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not parse type with internal type: undefined for custom structure

See original GitHub issue

I have some contracts using a library structure data storage, compiled using an older version of Solidity, but which throw an error asking me to make a report here.

In the libraryType.sol contract I have something like this:

library PersonLib {
    struct Data {
        bool   isActive;
        bytes  hashOfData;
        string handle;
    }
    function handle(Data storage self) public view returns (string) {
        return self.handle;
    }
    function markActive(Data storage self) internal {
        self.isActive = true;
    }
    //other getters & setters omitted
}

In other contracts, the library contract is imported and the type of a variable or struct member might be PersonLib.Data - sometimes, there are more than one of the same type in the same file (e.g. a Requester and a Contributor with wrapper functions similar to this:

    function requesterHandle() public view returns (string) {
        return requester.handle;
    }
    function updateRequesterHandle(string newHandle) public {
        emit RequesterHandleUpdated(newHandle);
        PersonLib.updateHandle(requester, newHandle);
    }

That works fine in Solidity, but when trying to generate types with TypeChain, that triggers an error like this:

Could not parse type: PersonLib.Data storage with internal type: undefined.

Please submit a GitHub Issue to the TypeChain team with the failing contract/library.

This error report is hereby filed per request. Hopefully I haven’t missed something important when attempting to make it a minimal example for the report.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
StefanoGagliardicommented, May 24, 2022

Thanks for your reply!

I got an error with this parameters: --target=truffle-v4 and Solidity version “0.6.4”. I also try with solidity version “0.4.24” and same target --target=truffle-v4.

Both case i got this error: Error occured: Class extends value undefined is not a constructor or null. I was unable to get the same message you posted at the beginning of this issue.

  1. You got the same error?
  2. NB: More important, I was thinking where is the problem to generate Type using like target: “truffle-v5” ?
    “V5” is related to Typechain is not related with ethereum.
    Please try to compile Smart Contracts with this target and give me a feedback. If there are no compilation errors I would say close the issue as “truffle-v4” I think is deprecated, correct? @krzkaczor
1reaction
wbtcommented, May 24, 2022

I wound up changing Typechain and dependencies to use --target=truffle-v4 and it still produced the same errors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

zod/ERROR_HANDLING.md at master · colinhacks/zod - GitHub
This is an enum used by Zod internally to represent the type of a parsed value. The possible values are: string; nan; number;...
Read more >
Error : Cannot read property 'map' of undefined - Stack Overflow
The error Cannot read property 'map' of undefined' is thrown when the map function in the CommentList component is executed.
Read more >
JavaScript data types and data structures - MDN Web Docs
In practice, the difference is minor, since undefined should not be redefined or shadowed. Boolean type. The Boolean type represents a logical ...
Read more >
Indexer errors and warnings - Azure Cognitive Search
Failed to extract a collection of JSON entities from a string value. Could not parse value 'of type 'Edm.String'' of field '_data_' as...
Read more >
Failed to parse field of type in document with id ''. - Opster
In a nutshell, this error just means that you provided a value which could not be parsed by Elasticsearch for the field's type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found