{"record":{"id":"818fbe66670a5d69","repo":"voormedia/rails-erd","slug":"saving-diagram-failed-verify-that-graphviz-is-ins","errorCode":null,"errorMessage":"Saving diagram failed!\nVerify that Graphviz is installed and in your path, or use filetype=dot.","messagePattern":"Saving diagram failed!\nVerify that Graphviz is installed and in your path, or use filetype=dot\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/rails_erd/diagram/graphviz.rb","lineNumber":227,"sourceCode":"        graph[:splines] = options.splines unless options.splines.nil?\n\n        # Setup notation options.\n        extend self.class.const_get(options.notation.to_s.capitalize.to_sym)\n      end\n\n      save do\n        raise \"Saving diagram failed!\\nOutput directory '#{File.dirname(filename)}' does not exist.\" unless File.directory?(File.dirname(filename))\n\n        begin\n          # GraphViz doesn't like spaces in the filename\n          graph.output(filetype => filename.gsub(/\\s/,\"_\"))\n          filename\n        rescue RuntimeError => e\n          raise \"Saving diagram failed!\\nGraphviz produced errors. Verify it \" +\n                  \"has support for filetype=#{options.filetype}, or use \" +\n                  \"filetype=dot.\\nOriginal error: #{e.message.split(\"\\n\").last}\"\n        rescue StandardError => e\n          raise \"Saving diagram failed!\\nVerify that Graphviz is installed \" +\n                  \"and in your path, or use filetype=dot.\"\n        end\n      end\n\n      each_entity do |entity, attributes|\n        if options[:cluster] && entity.namespace\n          cluster_name = \"cluster_#{entity.namespace}\"\n          cluster_options = CLUSTER_ATTRIBUTES.merge(label: entity.namespace)\n          cluster = graph.get_graph(cluster_name) ||\n                    graph.add_graph(cluster_name, cluster_options)\n\n          draw_cluster_node cluster, entity.name, entity_options(entity, attributes)\n        else\n          draw_node entity.name, entity_options(entity, attributes)\n        end\n      end\n\n      each_specialization do |specialization|","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/voormedia/rails-erd/blob/dae6e52018c94ff6d3e3bb0fdbc2cb0c680ec165/lib/rails_erd/diagram/graphviz.rb#L209-L245","documentation":"The second rescue in the same save block (graphviz.rb:226-229) catches StandardError -- in practice Errno::ENOENT -- raised when ruby-graphviz tries to execute the 'dot' executable and cannot find it. Unlike the RuntimeError branch, dot never ran: there is no dot binary on the PATH of the process generating the diagram. The message directs you to install Graphviz or, if that is impossible, use filetype=dot.","triggerScenarios":"graph.output spawning 'dot' when the Graphviz package is not installed; PATH not containing dot in the executing context (cron, systemd, Capistrano, IDE shells, Docker images without graphviz); dot present but not executable.","commonSituations":"Diagrams generate locally (brew install graphviz) but CI or deploy has no graphviz package; rake erd inside a slim Docker image; PATH stripped or different under cron/systemd units; new team members who never installed Graphviz.","solutions":["Install Graphviz so 'dot' is on PATH: macOS brew install graphviz; Debian/Ubuntu sudo apt-get install graphviz; Alpine apk add graphviz; Fedora sudo dnf install graphviz","Verify in the SAME environment that runs rails-erd: which dot && dot -V","If you cannot install system packages, switch to generator: mermaid, which writes the .mmd file in pure Ruby with no external binary"],"exampleFix":"# before\nbundle exec rake erd\n# => RuntimeError: ... Verify that Graphviz is installed and in your path ...\n\n# after (Dockerfile / CI)\nRUN apt-get update && apt-get install -y graphviz\nbundle exec rake erd","handlingStrategy":"validation","validationCode":"def dot_available?\n  system('dot', '-V', out: File::NULL, err: File::NULL)\nend\n\nif dot_available?\n  RailsERD::Diagram::Graphviz.create\nelse\n  RailsERD::Diagram::Mermaid.create\nend","typeGuard":null,"tryCatchPattern":"begin\n  RailsERD::Diagram::Graphviz.create\nrescue StandardError => e\n  raise unless e.message.include?('Verify that Graphviz is installed')\n  RailsERD::Diagram::Mermaid.create\nend","preventionTips":["Add graphviz to Dockerfile/CI dependency steps, not just the local brew install","Preflight 'dot -V' in any cron/systemd context that runs erd","Use the Mermaid generator in environments where system packages cannot be installed"],"tags":["ruby","rails-erd","graphviz","dot","binary-not-found","path","docker","ci"],"backgroundTag":"graphviz-not-installed","analyzedSha":"dae6e52018c94ff6d3e3bb0fdbc2cb0c680ec165","analyzedAt":"2026-08-23T02:52:18.679Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}