I'm running into the follow Lucid error from Week4 of Plutus pioneer program:

/workspace/code/Week04/lecture# deno run -A lucid-vesting.ts
error: Uncaught (in promise) TypeError: Cannot convert undefined to a BigInt
      keyDeposit: BigInt(result.key_deposit),
    at BigInt (<anonymous>)
    at Blockfrost.getProtocolParameters (https://deno.land/x/[email protected]/src/provider/blockfrost.ts:39:19)
    at async Function.new (https://deno.land/x/[email protected]/src/lucid/lucid.ts:56:34)
    at async file:///workspace/code/Week04/lecture/lucid-vesting.ts:19:15

I tried updating the import to use the latest Lucid version, but it didn't help:

from "https://deno.land/x/[email protected]/mod.ts"

I'm not sure what these type errors mean

1 Answer 1


The result.key_deposit is undefined, which means it is not set to a value (and not null either). BigInt() expects you to provide a valid integer number either as a number or a string. Therefore BigInt() throws an error when you provide undefined instead.

Check what happens in your code before this line to figure out why result.key_deposit doesn't contain a number.

See BigInt coercion for more info on BigInt errors.

One likely pitfall I can see is that you might not have replaced the Blockfrost API key:

// set blockfrost endpoint
const lucid = await Lucid.new(
  new Blockfrost(
    "insert you own api key here" // <-- REPLACE THIS WITH A REAL API KEY

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.