Skip to content

Instantly share code, notes, and snippets.

@KonnorRogers
Created August 16, 2026 03:45
Show Gist options
  • Select an option

  • Save KonnorRogers/5e415db7b1f48b73f06342085f41c7f9 to your computer and use it in GitHub Desktop.

Select an option

Save KonnorRogers/5e415db7b1f48b73f06342085f41c7f9 to your computer and use it in GitHub Desktop.
Things that trigger `codegen error: too big operand`
# > 256 locals.
def tick(args)
# This is the most common. Easiest way around it is to split up locals into separate methods as the 256 limit is per "block"
l_0 = nil; l_1 = nil; l_2 = nil;
end
# > 256 globals.
$var1 = nil
$var2 = nil
# > 256 "literals" in an array
ary = [1, 2, 3, 4]
class Foo
# > 256 class vars
@@foo_1 = nil
@@foo_2 = nil
# > 256 ivars
def initialize
@foo_1 = nil
@foo_2 = nil
end
end
# > 31 kwargs (defining)
def foo(kwarg_0: nil, kwarg_1: nil); end
# > 256 literal kwargs (passed as arg)
def foo(**kwargs); end
foo(kwarg_0: nil, kwarg_1: nil); end
# > 256 method definitions (probably classes too)
def foo_1; end
def foo_2; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment