Can anyone help with these error messages?

I’m building a pack and I keep getting these three errors, and I’m not sure where they’re coming from or what to do with them.

  1. isolate is already disposed
  2. Error: Runtime exited with error: exit status 128
  3. formula failed could not be cloned

What I think might be related to what’s causing these errors:

  • console.logging circular objects
  • object properties that are functions (but these seem to work in some cases and not others)

Anyone got more wisdom on what to do with these error messages?

Interesting, not errors I’ve run into before. Those sound like good guesses, as they certainly seem like edge cases we may not have planned for. Have you tried to reproduce the errors purposefully using those techniques?

After a little more testing, I all but confirmed my suspicions:

  • trying to log circular objects (ie js objects where at least one value is a reference to itself or an ancestor) leads to “isolate is already disposed” error
  • object properties that are functions (rather than class methods) seem to cause “formula could not be cloned” errors when those properties are assigned

I wasn’t systematic enough in my testing to confirm 100% this is what’s happening, but I’m 90% sure that’s what’s going on.

I can live without logging circular objects, that’s not a big deal. But not being able to use functions as values does feel kinda limiting. It’s annoying to have to build classes or switch-case statements for everything when simply assigning a function to a property would do the trick.

The runtime error with exit status 128 I still get every once in a while, but it’s rare (1 in 100-ish) and seemingly random — just running the same calculation again with identical input is usually enough to move past the error.

Hi @Ryan_Martens2 - Thanks for following up and digging into these errors. It would certainly help me out if you could share a sample Pack that demonstrates these issues, since I’m having trouble understanding and reproducing the error case. For example, the following Pack logs a circular reference and it runs without error:

import * as coda from "@codahq/packs-sdk";
export const pack = coda.newPack();

pack.addFormula({
  name: "Circular",
  description: "",
  parameters: [],
  resultType: coda.ValueType.String,
  execute: async function ([], context) {
    let a: Record<string, any> = {b: 2};
    console.log(a);
    a.a = a;
    console.log(a);
    return "Works";
  },
});

I’m still not sure what you mean by “object properties that are functions (rather than class methods)” so I don’t know where to begin there.

Could you write some small sample Packs that reliably trigger these errors?

The error when you try to do console.log on an object that references a function is an unfortunate side-effect of a recent performance improvement to better support passing around large objects like binary-encoded images.

Supporting all types of objects without erroring out is tricky, but if you give me a week or so we may be able to get some kind of quick-and-dirty solution out that at least avoids breaking on the types of objects you’re describing like {someFunc: () => true}

5 Likes

A fix is expected to roll out by the end of this week

3 Likes