Skip to content

Please provide better error message if there are no outputs in a recipe #5770

@simon-ess

Description

@simon-ess

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

If you have a recipe that will produce no outputs, possibly because you are skipping your local architecture:

build:
  skip: True  # [whatever system I am currently on]

then running something like

conda debug recipe

yeilds a very cryptic error (for conda build 25.7.0):

    Traceback (most recent call last):
      File "/Users/simonrose/micromamba/envs/cb/lib/python3.13/site-packages/conda/exception_handler.py", line 28, in __call__
        return func(*args, **kwargs)
      File "/Users/simonrose/micromamba/envs/cb/lib/python3.13/site-packages/conda/cli/main.py", line 61, in main_subshell
        exit_code = do_call(args, parser)
      File "/Users/simonrose/micromamba/envs/cb/lib/python3.13/site-packages/conda/cli/conda_argparse.py", line 182, in do_call
        result = plugin_subcommand.action(getattr(args, "_args", args))
      File "/Users/simonrose/micromamba/envs/cb/lib/python3.13/site-packages/conda_build/plugin.py", line 29, in debug
        return execute(args)
      File "/Users/simonrose/micromamba/envs/cb/lib/python3.13/site-packages/conda_build/cli/main_debug.py", line 102, in execute
        activation_string = api.debug(
            parsed.recipe_or_package_file_path,
            verbose=(not parsed.activate_string_only),
            **parsed.__dict__,
        )
      File "/Users/simonrose/micromamba/envs/cb/lib/python3.13/site-packages/conda_build/api.py", line 642, in debug
        run_build(target_metadata, stats={}, provision_only=True)
                  ^^^^^^^^^^^^^^^
    UnboundLocalError: cannot access local variable 'target_metadata' where it is not associated with a value

I was able to figure this out by digging into the conda build source code and realised that during the rendering all of my outputs were being skipped. However, it would be a lot nicer if this instead said something like

No outputs to render, skipping. Have a great day!

Or, well, something better than a stack trace.

Why is this needed?

People who don't like stack traces during relatively normal operation of tools 😄

What should happen?

Either the exception should be caught, or an earlier gentle exit should happen.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type::featurerequest for a new feature or capability

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions