Skip to content

How to see stack trace from Zygote macro expansion error #1589

@paulxshen

Description

@paulxshen

Hello I get Zygote error:

Compiling Tuple{typeof(myfunc), OrderedDict{Symbol, Any}}: ArgumentError: array must be non-empty

[1] macro expansion
    @ C:\Users\default.LAPTOP-HMRU58MH\.julia\packages\Zygote\55SqB\src\compiler\interface2.jl:0 [inlined]
[2] _pullback(ctx::Zygote.Context{false}, f::typeof(ff), args::OrderedDict{Symbol, Any})
    @ Zygote C:\Users\default.LAPTOP-HMRU58MH\.julia\packages\Zygote\55SqB\src\compiler\interface2.jl:81
Julia Version 1.12.0-rc3
Commit 7522b24014 (2025-09-26 07:42 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
  GC: Built with stock GC
Threads: 16 default, 1 interactive, 16 GC (on 16 virtual cores)
Environment:
  JULIA_DEBUG = Main
  JULIA_PKG_PRECOMPILE_AUTO = 0
  JULIA_EDITOR = code
  JULIA_VSCODE_REPL = 1
  JULIA_NUM_THREADS = 16

The macro expansion points to [1] interface2.jl:0 (non-existent line 0). [2] interface2.jl:81 is some eval expression which generated the code that erred whose whole stack trace I can't see. Is there a way of seeing a more helpful stack trace from the macro?

I've used Zygote for many years and encountered this after refactoring previously working code.
Yes I checked the obvious for empty arrays on my end but it's not it. Bizarrely I can (sometimes) get parts of it to work by renaming functions or changing their order so IDK if it's a weird world age problem. Errs on both Julia 11 and 12. It's rather convoluted to produce a MWE..

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