Skip to content

graphviz warnings are silently discarded #14362

@marc-hb

Description

@marc-hb

Describe the bug

graphviz warnings are silently discarded.

Deciding what to do with warnings is not always easy. For instance, look at the massive number of different -Werror=xxx options on this page: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

But in this case dot simply emits warnings on stderr. So why not just let dot's stderr pass-through?

Is sphinx.ext.graphviz simply discard stderr by any chance? Silently discarding stderr = one of the worst anti-patterns :-( Raises the traditionally bad error handling industry standards to a whole new level.

How to Reproduce

conf.py

extensions = [
     "sphinx.ext.graphviz",
]

index.rst

This is a graphiz test
######################

.. graphviz::
   :caption: Flat state machine diagram1

   digraph smf_flat {
      node [style=INVALID];
      init [shape = point];
      STATE_S0 [shape = box];
      STATE_S1 [shape = box];
      STATE_S2 [shape = box];

      init -> STATE_S0;
      STATE_S0 -> STATE_S1;
      STATE_S1 -> STATE_S2;
      STATE_S2 -> STATE_S0;
   }

dot -o _ test.dot ; echo $? prints this:

Warning: gvrender_set_style: unsupported style INVALID - ignoring
Warning: gvrender_set_style: unsupported style INVALID - ignoring
Warning: gvrender_set_style: unsupported style INVALID - ignoring
0

But sphinx-build -vv ... shows nothing related. Those warnings are silently discarded. To find and see them, one must manually copy the source to a separate file and run dot manually. Of course, no one will ever do that.

Environment Information

Platform:              linux; (Linux-6.19.9-200.fc43.x86_64-x86_64-with-glibc2.42)
Python version:        3.14.3 (main, Feb  4 2026, 00:00:00) [GCC 15.2.1 20260123 (Red Hat 15.2.1-7)])
Python implementation: CPython
Sphinx version:        9.1.0
Docutils version:      0.21.2
Jinja2 version:        3.1.6
Pygments version:      2.19.1

Sphinx extensions

sphinx.ext.graphviz

Additional context

This was originally found and described in

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions