oxidecomputer / oxidecomputer/progenitor

Bug Report: Progenitor panic during OpenAPI schema processing

Open
#1,104 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
136
Avg merge
8h 36m
Merged PRs (30d)
14

Description

Summary

Two distinct errors occur when using cargo-progenitor to generate Rust code from an OpenAPI schema:

  1. Internal Error: Unreachable code panic in typify_impl crate
  2. Enum Naming Conflict: Failure to generate unique enum variant names

Environment

  • OS: macOS 15.3 (24D5034f)
  • Rust Toolchain: rustc 1.87.0-nightly (be73c1f46 2025-03-21)
  • Cargo: 1.87.0-nightly (6cf826701 2025-03-14)
  • cargo-progenitor: Multiple versions tested(latest crates.io and github main)

Error 1: Internal Error (crates.io version)

Command
cargo progenitor -i openapi.json -o flashnet-api -n flashnet-api -v 0.1.0
Error Message
thread 'main' panicked at /path/to/typify-impl-0.3.0/src/value.rs:168:31:
internal error: entered unreachable code
Stack Trace
stack backtrace:
   0:        0x1045c455c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he81ee2f6917ac346
   1:        0x1045e1210 - core::fmt::write::hb8bd6ebe8d126f01
   2:        0x1045c1c7c - std::io::Write::write_fmt::h231b749ddbdedad8
   3:        0x1045c4410 - std::sys::backtrace::BacktraceLock::print::haa0f7dcd7d675535
   4:        0x1045c52b0 - std::panicking::default_hook::{{closure}}::h348ab2736102eb75
   5:        0x1045c5100 - std::panicking::default_hook::h511f34b773963527
   6:        0x1045c5d90 - std::panicking::rust_panic_with_hook::h9212a4961c7816e2
   7:        0x1045c5994 - std::panicking::begin_panic_handler::{{closure}}::h36c66d732862ba4e
   8:        0x1045c4a0c - std::sys::backtrace::__rust_end_short_backtrace::h1a358ecd2efce9b5
   9:        0x1045c5664 - __rustc[a9f817043035500e]::rust_begin_unwind
  10:        0x1045fec28 - core::panicking::panic_fmt::h93d6168e6a972526
  11:        0x1045fec98 - core::panicking::panic::h9bc603bd595e5787
  12:        0x1043a515c - typify_impl::value::<impl typify_impl::type_entry::TypeEntry>::output_value::h371d1f35c6ab1e18
  13:        0x1043a4a2c - typify_impl::value::<impl typify_impl::type_entry::TypeEntry>::output_value::h371d1f35c6ab1e18
  14:        0x1043914f4 - typify_impl::defaults::<impl typify_impl::type_entry::TypeEntry>::default_fn::h636e061fb15039d5
  15:        0x104422ad4 - typify_impl::structs::generate_serde_attr::ha08443aa691a3d0c
  16:        0x104399254 - typify_impl::type_entry::TypeEntry::output_struct::hd9c1bedafb1bc337
  17:        0x104393aac - typify_impl::type_entry::TypeEntry::output::h3aa954e680862016
  18:        0x1043c1cf0 - typify_impl::TypeSpace::to_stream::h5159ab332df57e0c
  19:        0x1042661bc - progenitor_impl::Generator::generate_tokens::h74316bf692ea8887
  20:        0x1041ad3a4 - cargo_progenitor::main::h01165f9824f04b28
  21:        0x1041f2704 - std::sys::backtrace::__rust_begin_short_backtrace::h229088e7ef092790
  22:        0x1041d5870 - std::rt::lang_start::{{closure}}::h34f76fd4b2aa70a5
  23:        0x1045bb998 - std::rt::lang_start_internal::h812ab8fe58e67928
  24:        0x1041b2734 - _main

Error 2: Enum Naming Conflict (from github main)

Command
RUST_BACKTRACE=1 cargo progenitor -i openapi.json -o flashnet-api -n flashnet-api -v 0.1.0
Error Message
thread 'main' panicked at /Users/.cargo/git/checkouts/typify-854920f7bf9e46dd/4bffebf/typify-impl/src/type_entry.rs:281:13:
Failed to make unique variant names for [1m,1M]
Stack Trace
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: typify_impl::type_entry::TypeEntryEnum::from_metadata
   3: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_enum_string
   4: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema_object
   5: typify_impl::convert::<impl typify_impl::TypeSpace>::convert_schema
   6: typify_impl::TypeSpace::convert_ref_type
   7: typify_impl::TypeSpace::add_ref_types
   8: progenitor_impl::Generator::generate_tokens
   9: cargo_progenitor::main

Affected Components

  1. typify_impl
  2. cargo-progenitor CLI tool
  3. OpenAPI schema processing

prettyprint.json

openapi.json

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the cargo progenitor command with the attached openapi.json, then inspect typify-impl/src/value.rs around line 168 and typify-impl/src/type_entry.rs around line 281. Trace both panic paths through cargo-progenitor and progenitor_impl. Done means the schema processes without either panic and enum variants are generated uniquely.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, rust
Domain
api, cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.