Recently, we’ve been getting some strange errors during the Middleman build on our CI. For most files, we are seeing the error “pathname contains null byte”. The error does not happen on local builds and nothing has changed in our CI lately. Of course, we are looking to see if the issue is on our end but meanwhile, thought I’d throw this out there to see if anyone has any ideas or if this has affected others.
Here’s the full stack trace from one error’ed page. You can see that the Spanish (es) version builds just fine but then the Portuguese version fails with above error.
== Request: /es/index.html
== Finishing Request: es/index.html (0.62s)
create build/es/index.html
== Request: /pt/index.html
error build/pt/index.html
pathname contains null byte
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util/paths.rb:191:in `initialize'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util/paths.rb:191:in `Pathname'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util/paths.rb:191:in `url_for'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util/paths.rb:119:in `asset_url'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util/paths.rb:96:in `asset_path'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/core_extensions/default_helpers.rb:203:in `asset_path'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/core_extensions/default_helpers.rb:140:in `block in javascript_include_tag'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/core_extensions/default_helpers.rb:138:in `each'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/core_extensions/default_helpers.rb:138:in `reduce'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/core_extensions/default_helpers.rb:138:in `javascript_include_tag'
layouts/layout.erb:4:in `block in singleton class'
layouts/layout.erb:-8:in `instance_eval'
layouts/layout.erb:-8:in `singleton class'
layouts/layout.erb:-11:in `__tilt_47323731138900'
/usr/local/bundle/gems/tilt-2.0.9/lib/tilt/template.rb:170:in `call'
/usr/local/bundle/gems/tilt-2.0.9/lib/tilt/template.rb:170:in `evaluate'
/usr/local/bundle/gems/tilt-2.0.9/lib/tilt/template.rb:109:in `render'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/file_renderer.rb:79:in `render'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/template_renderer.rb:157:in `block in render'
/usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util.rb:21:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/template_renderer.rb:156:in `render'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/sitemap/resource.rb:154:in `render'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/rack.rb:112:in `process_request'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/rack.rb:66:in `block in call'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/rack.rb:65:in `catch'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/rack.rb:65:in `call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/urlmap.rb:68:in `block in call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/urlmap.rb:53:in `each'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/urlmap.rb:53:in `call'
/usr/local/bundle/gems/htmlcompressor-0.2.0/lib/htmlcompressor/rack.rb:36:in `call'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/core_extensions/inline_url_rewriter.rb:74:in `call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/head.rb:12:in `call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/lint.rb:49:in `_call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/lint.rb:37:in `call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/builder.rb:153:in `call'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/mock.rb:74:in `request'
/usr/local/bundle/gems/rack-2.0.7/lib/rack/mock.rb:56:in `get'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/builder.rb:232:in `block in output_resource'
/usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util.rb:21:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/builder.rb:225:in `output_resource'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:504:in `call_with_index'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:471:in `process_incoming_jobs'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:453:in `block in worker'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:444:in `fork'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:444:in `worker'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:435:in `block in create_workers'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:434:in `each'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:434:in `each_with_index'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:434:in `create_workers'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:373:in `work_in_processes'
/usr/local/bundle/gems/parallel-1.17.0/lib/parallel.rb:277:in `map'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/builder.rb:137:in `output_resources'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/builder.rb:131:in `output_files'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/builder.rb:71:in `block in run!'
/usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util.rb:21:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/builder.rb:70:in `run!'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/usr/local/bundle/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/usr/local/bundle/gems/middleman-cli-4.3.4/lib/middleman-cli/build.rb:84:in `block in build'
/usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/bundle/gems/middleman-core-4.3.4/lib/middleman-core/util.rb:21:in `instrument'
/usr/local/bundle/gems/middleman-cli-4.3.4/lib/middleman-cli/build.rb:83:in `build'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `block in invoke_all'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `each'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `map'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `invoke_all'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/group.rb:232:in `dispatch'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
/usr/local/bundle/gems/thor-0.20.3/lib/thor.rb:40:in `block in register'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/bundle/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/usr/local/bundle/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
/usr/local/bundle/gems/middleman-cli-4.3.4/bin/middleman:70:in `<top (required)>'
/usr/local/bundle/bin/middleman:23:in `load'
/usr/local/bundle/bin/middleman:23:in `<top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:463:in `exec'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:18:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'