{"record":{"id":"724d2c54318b23df","repo":"gohugoio/hugo","slug":"got-unexpected-eof-when-executing-q-the-user-run","errorCode":null,"errorMessage":"got unexpected EOF when executing %q. The user running hugo must have read and execute permissions on this program. With execute permissions only, this error is thrown.","messagePattern":"got unexpected EOF when executing %q\\. The user running hugo must have read and execute permissions on this program\\. With execute permissions only, this error is thrown\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/resource_transformers/tocss/dartsass/client.go","lineNumber":124,"sourceCode":"}\n\nfunc (c *Client) Close() error {\n\tif c.transpiler == nil {\n\t\treturn nil\n\t}\n\treturn c.transpiler.Close()\n}\n\nfunc (c *Client) toCSS(args godartsass.Args, src io.Reader) (godartsass.Result, error) {\n\tin := helpers.ReaderToString(src)\n\n\targs.Source = in\n\n\tres, err := c.transpiler.Execute(args)\n\tif err != nil {\n\t\tif err.Error() == \"unexpected EOF\" {\n\t\t\t//lint:ignore ST1005 end user message.\n\t\t\treturn res, fmt.Errorf(\"got unexpected EOF when executing %q. The user running hugo must have read and execute permissions on this program. With execute permissions only, this error is thrown.\", hugo.DartSassBinaryName)\n\t\t}\n\t\treturn res, herrors.NewFileErrorFromFileInErr(err, hugofs.Os, herrors.OffsetMatcher)\n\t}\n\n\treturn res, err\n}\n\ntype Options struct {\n\t// Hugo, will by default, just replace the extension of the source\n\t// to .css, e.g. \"scss/main.scss\" becomes \"scss/main.css\". You can\n\t// control this by setting this, e.g. \"styles/main.css\" will create\n\t// a Resource with that as a base for RelPermalink etc.\n\tTargetPath string\n\n\t// Hugo automatically adds the entry directories (where the main.scss lives)\n\t// for project and themes to the list of include paths sent to LibSASS.\n\t// Any paths set in this setting will be appended. Note that these will be\n\t// treated as relative to the working dir, i.e. no include paths outside the","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/resource_transformers/tocss/dartsass/client.go#L106-L142","documentation":"Returned by the Dart Sass toCSS path when c.transpiler.Execute returns an error whose message is exactly 'unexpected EOF'. Hugo interprets this specific embedded-protocol error as a filesystem permission problem: the dart-sass-embedded binary was invoked but the Hugo process lacks read permission on it (execute-only). The message guides the user to fix permissions on the binary.","triggerScenarios":"css.Sass/ToCSS with transpiler='dartsass' runs, the embedded binary starts, but reading its executable image (or a temp/protocol file) fails because the running user has execute but not read permission on hugo.DartSassBinaryName, producing 'unexpected EOF' from the transpiler.","commonSituations":"Binary installed with mode 0711 or 0111 (execute-only, no read), common in hardened/containerized environments or when an installer drops read bits; running Hugo as a different user than the binary owner without group read.","solutions":["Grant read+execute on the Dart Sass binary to the Hugo user, e.g. `chmod 0755 $(which sass)` or `chmod o+rx /path/to/dart-sass-embedded`.","Ensure the user running hugo also owns or is in the owning group of the binary and its parent directories.","Reinstall Dart Sass via a method that sets standard 0755 permissions."],"exampleFix":"// before\n$ ls -l $(which sass)\n-rwx--x--x ... sass\n\n// after\n$ sudo chmod 0755 $(which sass)\n$ ls -l $(which sass)\n-rwxr-xr-x ... sass","handlingStrategy":"validation","validationCode":"// Verify read+execute permission on the Dart Sass binary for the Hugo user.\nfunc binaryReadable(bin string) error {\n    fi, err := os.Stat(bin)\n    if err != nil { return err }\n    mode := fi.Mode().Perm()\n    if mode&0004 == 0 { // others-read\n        return fmt.Errorf(\"%s not world-readable (mode %o); chmod 0755\", bin, mode)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Dart Sass with standard 0755 permissions.","In containers, run Hugo as a user with read+execute on the binary and its directories.","Add a CI check that asserts the binary mode is 0755."],"tags":["dart-sass","permissions","filesystem","environment"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}