Error: Input file contains unsupported image format, gatsby

I can build locally just fine. I’ve double checked that the image in question is in the repo.
Things I’ve tried: specifying each entry in my package.json one by one.
Also tried using a different image. This was building and deploying fine yesterday and the previous days for a couple months. Looking through all the commits I didn’t touch the files that reference this failing png image.

Relevant section from below:

10:52:38 AM: info bootstrap finished - 6.984 s
10:52:38 AM: ⠀
10:52:38 AM: error Failed to process image /opt/build/repo/static/img/home-comparison-beaker.png Input file contains unsupported image format
10:52:38 AM: 
10:52:38 AM:   Error: Input file contains unsupported image format
10:52:38 AM: 
10:52:38 AM: not finished run queries - 0.204s

I need advice to debug deploy Netlify App

—begin entire build log—

10:51:16 AM: Build ready to start
10:51:18 AM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
10:51:18 AM: build-image tag: v3.3.7
10:51:18 AM: buildbot version: 11918e084194721d200458438c92ff8180b3b56c
10:51:18 AM: Fetching cached dependencies
10:51:18 AM: Starting to download cache of 303.9MB
10:51:20 AM: Finished downloading cache in 2.189943254s
10:51:20 AM: Starting to extract cache
10:51:29 AM: Finished extracting cache in 9.053371028s
10:51:29 AM: Finished fetching cache in 11.432478551s
10:51:29 AM: Starting to prepare the repo for build
10:51:30 AM: Preparing Git Reference refs/heads/master
10:51:33 AM: Found Netlify configuration file netlify.toml in site root
10:51:33 AM: Found Netlify configuration file(s). Overriding site configuration
10:51:33 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'lambda' versus '' in the Netlify UI
10:51:33 AM: Creating functions prep folder
10:51:33 AM: Starting build script
10:51:33 AM: Installing dependencies
10:51:33 AM: Started restoring cached node version
10:51:36 AM: Finished restoring cached node version
10:51:38 AM: v10.19.0 is already installed.
10:51:39 AM: Now using node v10.19.0 (npm v6.13.4)
10:51:39 AM: Attempting ruby version 2.6.2, read from environment
10:51:40 AM: Using ruby version 2.6.2
10:51:40 AM: Using PHP version 5.6
10:51:40 AM: Started restoring cached node modules
10:51:40 AM: Finished restoring cached node modules
10:51:40 AM: Started restoring cached yarn cache
10:51:40 AM: Finished restoring cached yarn cache
10:51:41 AM: Installing NPM modules using Yarn version 1.9.4
10:51:42 AM: yarn install v1.9.4
10:51:42 AM: [1/4] Resolving packages...
10:51:45 AM: [2/4] Fetching packages...
10:51:45 AM: (node:1201) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
10:52:07 AM: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
10:52:07 AM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
10:52:07 AM: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
10:52:07 AM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
10:52:07 AM: [3/4] Linking dependencies...
10:52:07 AM: warning "gatsby > react-hot-loader@4.12.18" has unmet peer dependency "@types/react@^15.0.0 || ^16.0.0".
10:52:07 AM: warning "gatsby > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
10:52:07 AM: warning "gatsby > gatsby-cli > ink@2.6.0" has unmet peer dependency "@types/react@>=16.8.0".
10:52:07 AM: warning "gatsby > gatsby-cli > ink > auto-bind@3.0.0" has unmet peer dependency "@types/react@>=16.8.0".
10:52:07 AM: warning "gatsby-plugin-netlify > webpack-assets-manifest@3.1.1" has unmet peer dependency "webpack@>=4.4.0".
10:52:07 AM: warning "gatsby-plugin-sass > sass-loader@7.3.1" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
10:52:07 AM: warning " > lodash-webpack-plugin@0.11.5" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
10:52:07 AM: warning "netlify-cms-app > netlify-cms-widget-markdown > slate-edit-list@0.11.3" has incorrect peer dependency "slate@^0.32.0".
10:52:07 AM: warning "netlify-cms-app > netlify-cms-widget-markdown > slate-edit-table@0.15.2" has incorrect peer dependency "slate@^0.33.3".
10:52:07 AM: warning "netlify-cms-app > netlify-cms-widget-markdown > slate-edit-table@0.15.2" has unmet peer dependency "slate-schema-violations@^0.1.7".
10:52:07 AM: warning "netlify-cms-app > netlify-cms-core > redux-notifications > react-redux@4.4.10" has incorrect peer dependency "redux@^2.0.0 || ^3.0.0".
10:52:07 AM: warning " > netlify-cms-media-library-cloudinary@1.3.4" has unmet peer dependency "netlify-cms-lib-util@^2.1.3-beta.0".
10:52:20 AM: [4/4] Building fresh packages...
10:52:29 AM: success Saved lockfile.
10:52:29 AM: Done in 47.21s.
10:52:29 AM: NPM modules installed using Yarn
10:52:30 AM: Started restoring cached go cache
10:52:30 AM: Finished restoring cached go cache
10:52:30 AM: unset GOOS;
10:52:30 AM: unset GOARCH;
10:52:30 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
10:52:30 AM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
10:52:30 AM: go version >&2;
10:52:30 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
10:52:30 AM: go version go1.12 linux/amd64
10:52:30 AM: Installing missing commands
10:52:30 AM: Verify run directory
10:52:30 AM: Executing user command: npm run build
10:52:30 AM: > gatsby-starter-netlify-cms@1.1.3 build /opt/build/repo
10:52:30 AM: > npm run clean && gatsby build
10:52:30 AM: > gatsby-starter-netlify-cms@1.1.3 clean /opt/build/repo
10:52:30 AM: > gatsby clean
10:52:31 AM: info Deleting .cache, public
10:52:31 AM: info Successfully deleted directories
10:52:34 AM: success open and validate gatsby-configs - 0.059s
10:52:36 AM: success load plugins - 1.952s
10:52:36 AM: success onPreInit - 0.066s
10:52:36 AM: success delete html and css files from previous builds - 0.016s
10:52:36 AM: success initialize cache - 0.011s
10:52:36 AM: success copy gatsby files - 0.056s
10:52:36 AM: success onPreBootstrap - 0.003s
10:52:36 AM: success createSchemaCustomization - 0.012s
10:52:37 AM: success source and transform nodes - 0.780s
10:52:37 AM: success building schema - 0.471s
10:52:37 AM: success createPages - 0.121s
10:52:37 AM: success createPagesStatefully - 0.173s
10:52:37 AM: success onPreExtractQueries - 0.004s
10:52:37 AM: success update schema - 0.032s
10:52:38 AM: success extract queries from components - 0.491s
10:52:38 AM: success write out requires - 0.004s
10:52:38 AM: success write out redirect data - 0.001s
10:52:38 AM: warning The icon(src/img/icon.png) you provided to 'gatsby-plugin-manifest' is not square.
10:52:38 AM: The icons we generate will be square and for the best results we recommend you provide a square icon.
10:52:38 AM: success Build manifest and related icons - 0.147s
10:52:38 AM: success onPostBootstrap - 0.149s
10:52:38 AM: ⠀
10:52:38 AM: info bootstrap finished - 6.984 s
10:52:38 AM: ⠀
10:52:38 AM: error Failed to process image /opt/build/repo/static/img/home-comparison-beaker.png Input file contains unsupported image format
10:52:38 AM: 
10:52:38 AM:   Error: Input file contains unsupported image format
10:52:38 AM: 
10:52:38 AM: not finished run queries - 0.204s
10:52:38 AM: npm ERR! code ELIFECYCLE
10:52:38 AM: npm ERR! errno 1
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM:  gatsby-starter-netlify-cms@1.1.3 build: `npm run clean && gatsby build`
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM:  Exit status 1
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM:  Failed at the gatsby-starter-netlify-cms@1.1.3 build script.
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM:  This is probably not a problem with npm. There is likely additional logging output above.
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM:  A complete log of this run can be found in:
10:52:38 AM: npm
10:52:38 AM: ERR!
10:52:38 AM:      /opt/buildhome/.npm/_logs/2020-03-20T14_52_38_887Z-debug.log
10:52:38 AM: Function Dir: /opt/build/repo/lambda
10:52:38 AM: TempDir: /tmp/zisi-5e74d8647a83680008d769ef
10:52:39 AM: Prepping functions with zip-it-and-ship-it 0.3.1
10:52:40 AM: [ { path: '/tmp/zisi-5e74d8647a83680008d769ef/hello.zip',
10:52:40 AM:     runtime: 'js' } ]
10:52:40 AM: Prepping functions complete
10:52:40 AM: Caching artifacts
10:52:40 AM: Started saving node modules
10:52:40 AM: Finished saving node modules
10:52:40 AM: Started saving yarn cache
10:52:40 AM: Finished saving yarn cache
10:52:40 AM: Started saving pip cache
10:52:40 AM: Finished saving pip cache
10:52:40 AM: Started saving emacs cask dependencies
10:52:40 AM: Finished saving emacs cask dependencies
10:52:40 AM: Started saving maven dependencies
10:52:40 AM: Finished saving maven dependencies
10:52:40 AM: Started saving boot dependencies
10:52:40 AM: Finished saving boot dependencies
10:52:40 AM: Started saving go dependencies
10:52:40 AM: Finished saving go dependencies
10:52:40 AM: Error running command: Build script returned non-zero exit code: 1
10:52:40 AM: Failing build: Failed to build site
10:52:40 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:52:40 AM: Finished processing build request in 1m22.283676601s

Hello @MikeMc, welcome!

The error log says enough, it seems like it doesn’t support the format? They should be square…

It supported it yesterday and the 40 days prior. Why would it stop supporting png images? Also it builds local. I’m thinking that it has something to do with creating the thumbnails, but I’m not sure what library does that. Seems like its blowing up on that step all of sudden, so maybe it’s a version problem with something in node_modules.

The issue is solved here:

Essentially I had to add

"resolutions": {
    "sharp": "0.24.0"
  },

to the package.json

Noob here on the community. How should I tag this and/or rewrite the question / subject so people with this error can find this better?

1 Like

that’s a great question, and thank you for answering it! The value of this forum rests on people being able to find information they need to solve problems they encounter as quickly as possible, after all!

first, if you have an error message, here, it is Error: Input file contains unsupported image format i would put that in the title of the post. That way, people who google error messages can find it right away.

I think a really good title for this thread would be something like:

"Error: Input file contains unsupported image format, gatsby" so that people can find things easier.

Secondly, I would indent your code, by placing three backticks: ` around it. (if you are needing to highlight a code snippet, one single backtick around a code chunk will do, but if its multiline, then 3.

Third, you already did the fantastic work of finding a solution, coming back, posting it, and marking your question as solved - this is great because it lets others know how to fix the problem.

thanks again for asking & being invested in having other people find solutions more easily :muscle:

1 Like

Thanks @perry Done and Done

1 Like

no, thank you! :tada:

Hi @MikeMc - thanks for renaming the thread, I just found it by googling “Input file contains unsupported image format gatsby” and it fixed my problem too!

2 Likes

I tried to the suggetion but it doesn`t work.
I think I mistook maybe.
But I fixed it this followings:

  1. Find old version for sharp: npm list sharp
  2. Upgrade version dependencies that uses old sharp version.

Example)

  1. List up
  2. Upgrade version
1 Like

Hello, I am also encountering the same problem and the previous solutions proposed unfortunately didn’t work for me.

My website is 7form.pl. Using Next, I am running a post-build script that with sharp creates webp versions of the images uploaded via Netlify CMS. Locally it works fine but on Netlify the script always fails with the error Error: Input file contains unsupported image format.

This is my package.json:

{
  "name": "7form",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "next",
    "build": "next build",
    "build:webp": "node buildSourceSetsImages.js",
    "start": "next start",
    "export": "npm run build && next export && NODE_ENV=production npm run build:webp",
    "lint": "eslint src --ext .js,.jsx,.ts,.tsx",
    "lint:fix": "npm run lint -- --fix",
    "type-check": "tsc --noEmit"
  },
  "keywords": [],
  "author": "Alberto Giachino",
  "license": "ISC",
  "dependencies": {
    "framer-motion": "^2.1.4",
    "front-matter": "^4.0.2",
    "markdown-to-jsx": "^6.11.4",
    "next": "^9.4.4",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "sharp": "^0.27.1",
    "styled-components": "^5.1.1"
  },
  "devDependencies": {
    "@types/markdown-to-jsx": "^6.11.0",
    "@types/node": "^14.0.14",
    "@types/react": "^16.9.41",
    "@types/styled-components": "^5.1.1",
    "@typescript-eslint/eslint-plugin": "^3.5.0",
    "@typescript-eslint/parser": "^3.5.0",
    "babel-plugin-styled-components": "^1.10.7",
    "eslint": "^7.4.0",
    "eslint-config-airbnb": "^18.2.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.20.3",
    "eslint-plugin-react-hooks": "^4.0.5",
    "frontmatter-markdown-loader": "^3.6.0",
    "prettier": "^2.0.5",
    "typescript": "^3.9.6"
  }
}

This is my script:

const fs = require('fs');
const path = require('path');

const sharp = require('sharp');

const SOURCE_SETS_BREAKPOINTS = Object.freeze([425, 768, 1024, 2560]);

const resizeTo = (width, outputDirectory) => ({ imagePath, imageName }) => {
  return new Promise((resolve, reject) => {
    sharp(imagePath)
      .resize(width)
      .webp()
      .toFile(`${outputDirectory}/${imageName}.BUILD.${width}.webp`)
      .then(resolve)
      .catch((error) => {
        reject(`
      ${imagePath}
      ${error}`);
      });
  });
};

const isProduction = process.env.NODE_ENV === 'production';

console.log(
  `---\n\nBuilding responsive images source sets${
    isProduction ? ' for production' : ''
  }...\n`
);

console.time('Done');

const uploadsPath = path.resolve(
  process.cwd(),
  isProduction ? 'out' : 'public',
  'static',
  'images',
  'uploads'
);

const webpPath = path.resolve(
  process.cwd(),
  isProduction ? 'out' : 'public',
  'static',
  'images',
  'webp'
);

// Make sure the uploadsPath path exists
if (!fs.existsSync(uploadsPath)) {
  throw new Error('Uploads folder does not exist');
}

// Always create a new webp directory
if (fs.existsSync(webpPath)) {
  fs.rmdirSync(webpPath, { recursive: true });
}

fs.mkdirSync(webpPath);

// Build the source sets images creators
const srcSetsCreators = SOURCE_SETS_BREAKPOINTS.map((breakpoint) =>
  resizeTo(breakpoint, webpPath)
);

// Retrieve all the source images
const srcImagesData = fs
  .readdirSync(uploadsPath)
  .filter((filename) => !/.+\.BUILD\.\d+\.webp/.test(filename))
  .map((fileName) => ({
    imagePath: path.resolve(uploadsPath, fileName),
    imageName: fileName,
  }));

// Create and save the source sets images
const sourceSetsPromises = srcImagesData.flatMap((imageData) =>
  srcSetsCreators.map((srcSetsCreator) => srcSetsCreator(imageData))
);

Promise.all(sourceSetsPromises).catch(err => {
  console.error(err)
  process.exit(1)
}).finally(() => {
  console.timeEnd('Done');
  console.log('\n---\n');
});

And finally this is the log of the last failed deploy on the develop branch:

10:06:25 AM: Build ready to start
10:06:27 AM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
10:06:27 AM: build-image tag: v3.6.1
10:06:27 AM: buildbot version: df42d44cc6a0381cf657a671baf049c03981bafe
10:06:27 AM: Fetching cached dependencies
10:06:27 AM: Starting to download cache of 202.3MB
10:06:28 AM: Finished downloading cache in 1.11711502s
10:06:28 AM: Starting to extract cache
10:06:35 AM: Finished extracting cache in 7.017333617s
10:06:35 AM: Finished fetching cache in 8.380676275s
10:06:35 AM: Starting to prepare the repo for build
10:06:35 AM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
10:06:36 AM: Preparing Git Reference refs/heads/develop
10:06:42 AM: Starting build script
10:06:42 AM: Installing dependencies
10:06:42 AM: Python version set to 2.7
10:06:43 AM: Started restoring cached node version
10:06:46 AM: Finished restoring cached node version
10:06:47 AM: v12.18.0 is already installed.
10:06:48 AM: Now using node v12.18.0 (npm v6.14.4)
10:06:48 AM: Started restoring cached build plugins
10:06:48 AM: Finished restoring cached build plugins
10:06:49 AM: Attempting ruby version 2.7.1, read from environment
10:06:50 AM: Using ruby version 2.7.1
10:06:51 AM: Using PHP version 5.6
10:06:51 AM: Started restoring cached node modules
10:06:51 AM: Finished restoring cached node modules
10:06:51 AM: Started restoring cached go cache
10:06:51 AM: Finished restoring cached go cache
10:06:51 AM: go version go1.14.4 linux/amd64
10:06:51 AM: go version go1.14.4 linux/amd64
10:06:51 AM: Installing missing commands
10:06:51 AM: Verify run directory
10:06:53 AM: ​
10:06:53 AM: ────────────────────────────────────────────────────────────────
10:06:53 AM:   Netlify Build                                                 
10:06:53 AM: ────────────────────────────────────────────────────────────────
10:06:53 AM: ​
10:06:53 AM: ❯ Version
10:06:53 AM:   @netlify/build 9.1.3
10:06:53 AM: ​
10:06:53 AM: ❯ Flags
10:06:53 AM:   deployId: 602f7f90915fbd000729fb28
10:06:53 AM:   mode: buildbot
10:06:53 AM: ​
10:06:53 AM: ❯ Current directory
10:06:53 AM:   /opt/build/repo
10:06:53 AM: ​
10:06:53 AM: ❯ Config file
10:06:53 AM:   No config file was defined: using default values.
10:06:53 AM: ​
10:06:53 AM: ❯ Context
10:06:53 AM:   branch-deploy
10:06:53 AM: ​
10:06:53 AM: ❯ Installing plugins
10:06:53 AM:    - netlify-plugin-cache-nextjs@1.4.0
10:07:03 AM: ​
10:07:03 AM: ❯ Loading plugins
10:07:03 AM:    - netlify-plugin-cache-nextjs@1.4.0 from Netlify app
10:07:03 AM: ​
10:07:03 AM: ────────────────────────────────────────────────────────────────
10:07:03 AM:   1. onPreBuild command from netlify-plugin-cache-nextjs        
10:07:03 AM: ────────────────────────────────────────────────────────────────
10:07:03 AM: ​
10:07:03 AM: No cache found for the .next folder at the location `.next/cache`
10:07:03 AM: ​
10:07:03 AM: (netlify-plugin-cache-nextjs onPreBuild completed in 239ms)
10:07:03 AM: ​
10:07:03 AM: ────────────────────────────────────────────────────────────────
10:07:03 AM:   2. Build command from Netlify app                             
10:07:03 AM: ────────────────────────────────────────────────────────────────
10:07:03 AM: ​
10:07:03 AM: $ npm run export
10:07:04 AM: > 7form@1.0.0 export /opt/build/repo
10:07:04 AM: > npm run build && next export && NODE_ENV=production npm run build:webp
10:07:04 AM: > 7form@1.0.0 build /opt/build/repo
10:07:04 AM: > next build
10:07:05 AM: Browserslist: caniuse-lite is outdated. Please run:
10:07:05 AM: npx browserslist@latest --update-db
10:07:05 AM: Warning: No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
10:07:05 AM: Creating an optimized production build...
10:07:10 AM: > Using external babel configuration
10:07:10 AM: > Location: "/opt/build/repo/.babelrc"
10:07:35 AM: Compiled successfully.
10:07:35 AM: 
10:07:35 AM: Automatically optimizing pages...
10:07:38 AM: Page                                                           Size     First Load JS
10:07:38 AM: ┌ ○ /                                                          3.15 kB         108 kB
10:07:38 AM: ├   /_app                                                      3.04 kB         105 kB
10:07:38 AM: ├ ○ /404                                                       3.25 kB         108 kB
10:07:38 AM: ├ ● /architektura                                              2.98 kB         108 kB
10:07:38 AM: ├ ○ /kontakt                                                   3.53 kB         108 kB
10:07:38 AM: ├ ○ /o-nas                                                     2.37 kB         114 kB
10:07:38 AM: ├ ● /projekty                                                  2.97 kB         108 kB
10:07:38 AM: ├ ● /projekty/[project]                                        1.5 kB          113 kB
10:07:38 AM: ├   ├ /projekty/%20naturalnie-w-czarnymlesie
10:07:38 AM: ├   ├ /projekty/biuro-dozamech
10:07:38 AM: ├   ├ /projekty/ceg%C5%82a-i-beton
10:07:38 AM: ├   └ [+13 more paths]
10:07:38 AM: └ ● /wnetrza                                                   2.99 kB         108 kB
10:07:38 AM: + First Load JS shared by all                                  105 kB
10:07:38 AM:   ├ static/pages/_app.js                                       3.04 kB
10:07:38 AM:   ├ chunks/05d954cf.685b71.js                                  20.8 kB
10:07:38 AM:   ├ chunks/77d77774cb3c9624e7505eba539675d0be9def92.3e4f00.js  9.18 kB
10:07:38 AM:   ├ chunks/bb2c3f56770e872b409ab48a4cdf9739f577b92c.003804.js  13.8 kB
10:07:38 AM:   ├ chunks/effe5231f24ca20b29e38e9f95b0d593f5bc120b.e8390e.js  10.2 kB
10:07:38 AM:   ├ chunks/framework.c6faae.js                                 40 kB
10:07:38 AM:   ├ runtime/main.e9656a.js                                     6.98 kB
10:07:38 AM:   ├ runtime/webpack.c21266.js                                  746 B
10:07:38 AM:   └ css/b6b00fcfab68dee18065.css                               157 B
10:07:38 AM: λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
10:07:38 AM: ○  (Static)  automatically rendered as static HTML (uses no initial props)
10:07:38 AM: ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
10:07:38 AM: > using build directory: /opt/build/repo/.next
10:07:38 AM:   copying "static build" directory
10:07:38 AM: > No "exportPathMap" found in "next.config.js". Generating map from "./pages"
10:07:38 AM:   launching 7 workers
10:07:38 AM: Exporting (0/7)
10:07:38 AM:   copying "public" directory
10:07:39 AM: Exporting (1/7)
10:07:39 AM: Exporting (2/7)
10:07:39 AM: Exporting (3/7)
10:07:39 AM: Exporting (4/7)
10:07:39 AM: Exporting (5/7)
10:07:39 AM: Exporting (6/7)
10:07:39 AM: Exporting (7/7)
10:07:39 AM: Export successful
10:07:40 AM: > 7form@1.0.0 build:webp /opt/build/repo
10:07:40 AM: > node buildSourceSetsImages.js
10:07:40 AM: ---
10:07:40 AM: Building responsive images source sets for production...
10:07:40 AM:       /opt/build/repo/out/static/images/uploads/109792821_3655427744486807_5377481951943737859_o.png
10:07:40 AM:       Error: Input file contains unsupported image format
10:07:40 AM: (sharp:1670): GLib-CRITICAL **: 09:07:40.784: g_hash_table_lookup: assertion 'hash_table != NULL' failed
10:07:40 AM: (sharp:1670): GLib-CRITICAL **: 09:07:40.784: g_hash_table_lookup: assertion 'hash_table != NULL' failed
10:07:40 AM: (sharp:1670): GLib-CRITICAL **: 09:07:40.785: g_hash_table_lookup: assertion 'hash_table != NULL' failed
10:07:40 AM: (sharp:1670): GLib-CRITICAL **: 09:07:40.785: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
10:07:40 AM: (sharp:1670): GLib-CRITICAL **: 09:07:40.785: g_hash_table_lookup: assertion 'hash_table != NULL' failed
10:07:41 AM: Segmentation fault (core dumped)
10:07:41 AM: npm ERR! code ELIFECYCLE
10:07:41 AM: npm ERR! errno 139
10:07:41 AM: npm ERR! 7form@1.0.0 build:webp: `node buildSourceSetsImages.js`
10:07:41 AM: npm ERR! Exit status 139
10:07:41 AM: npm ERR!
10:07:41 AM: npm ERR! Failed at the 7form@1.0.0 build:webp script.
10:07:41 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:07:41 AM: npm ERR! A complete log of this run can be found in:
10:07:41 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-02-19T09_07_41_101Z-debug.log
10:07:41 AM: npm ERR! code ELIFECYCLE
10:07:41 AM: npm ERR! errno 139
10:07:41 AM: npm ERR! 7form@1.0.0 export: `npm run build && next export && NODE_ENV=production npm run build:webp`
10:07:41 AM: npm ERR! Exit status 139
10:07:41 AM: npm ERR!
10:07:41 AM: npm ERR! Failed at the 7form@1.0.0 export script.
10:07:41 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:07:41 AM: npm ERR! A complete log of this run can be found in:
10:07:41 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-02-19T09_07_41_146Z-debug.log
10:07:41 AM: ​
10:07:41 AM: ────────────────────────────────────────────────────────────────
10:07:41 AM:   "build.command" failed                                        
10:07:41 AM: ────────────────────────────────────────────────────────────────
10:07:41 AM: ​
10:07:41 AM:   Error message
10:07:41 AM:   Command failed with exit code 139: npm run export
10:07:41 AM: ​
10:07:41 AM:   Error location
10:07:41 AM:   In Build command from Netlify app:
10:07:41 AM:   npm run export
10:07:41 AM: ​
10:07:41 AM:   Resolved config
10:07:41 AM:   build:
10:07:41 AM:     command: npm run export
10:07:41 AM:     commandOrigin: ui
10:07:41 AM:     environment:
10:07:41 AM:       - NETLIFY_LFS_ORIGIN_URL
10:07:41 AM:     publish: /opt/build/repo/out
10:07:41 AM:   plugins:
10:07:41 AM:     - inputs: {}
10:07:41 AM:       origin: ui
10:07:41 AM:       package: netlify-plugin-cache-nextjs
10:07:41 AM: Caching artifacts
10:07:41 AM: Started saving node modules
10:07:41 AM: Finished saving node modules
10:07:41 AM: Started saving build plugins
10:07:41 AM: Finished saving build plugins
10:07:41 AM: Started saving pip cache
10:07:41 AM: Finished saving pip cache
10:07:41 AM: Started saving emacs cask dependencies
10:07:41 AM: Finished saving emacs cask dependencies
10:07:41 AM: Started saving maven dependencies
10:07:41 AM: Finished saving maven dependencies
10:07:41 AM: Started saving boot dependencies
10:07:41 AM: Finished saving boot dependencies
10:07:41 AM: Started saving rust rustup cache
10:07:41 AM: Finished saving rust rustup cache
10:07:41 AM: Started saving go dependencies
10:07:41 AM: Finished saving go dependencies
10:07:41 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:07:41 AM: Failing build: Failed to build site
10:07:41 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
10:07:41 AM: Finished processing build request in 1m14.578660344s

Any help with this would be highly appreciated :confused:

@perry

Hiya and sorry to be slow to get back to you!

Can you build locally? This is always the first question we ask folks when they are debugging builds - Netlify’s CI isn’t magic and does require working source code to work, and if it doesn’t work locally, it is definitely a problem you’ll have to fix without our staff’s advice (we can’t help with problems in your source code, only our service).

If it does work locally, have you verified that we are using the same version of node and other dependencies that your local build does? Docs on that here: Manage build dependencies | Netlify Docs

Another common reason for gatsby build failures especially involving images, is memory use - it is possible that it’s simply “too heavy” for us to process within our build environment. More details on those situations in these two articles:

and

Finally, if those don’t help, when I run into this problem, I might try examining the image during build to make sure it IS valid. What’s its file size? what are its contents and permissions? You can do things like this to your build command to try to tell:

npm run export ; identify /opt/build/repo/out/static/images/uploads/109792821_3655427744486807_5377481951943737859_o.png ; false

This will run the identify command (ImageMagick - Command-line Tools: Identify) on the “image” and tell you what it knows about it - including if it is indeed not valid. Then it will force your deploy to fail so we don’t publish a broken one :slight_smile:

Hello @fool , thank you for your reply. Yes locally it works fine. It even works on the local Netlify Docker build image! When I run identify I indeed get: identify: improper image header . If I do it locally I get PNG 930x1125 930x1125+0+0 8-bit sRGB 976373B 0.000u 0:00.000. It seems like the image gets corrupted during the build process or something similar… could it be related to Large Media? After a lot of attempts, I really have no clue how to solve this problem anymore…

Yes, it’s due to Netlify Large Media. If I cat that file I get the git lfs reference and not the image content. Also, reading more in details the Large Media docs I see that:

Files tracked with Large Media are uploaded directly to the Netlify Large Media storage service on push, completely bypassing the site build. This saves build time, but also means that the files are not available to tools that process asset files during the build, such as Hugo’s image processing or the gatsby-image plugin.

Having discovered this, I would like to require assistance to disable Netlify Large Media on my website.

This my website API ID: 203c2c52-bf51-4daf-b6ce-329f88158144

Thanks for letting us know you want to uninstall the Large Media add-on for your site. Would you please confirm you have read the following Support Guide?

If you have read that, please confirm you have backups of all files.

​Please let us know if there are any questions!

Hello @perry , thank you for your reply. Yes I have read the guide and I have backups of my files. Please proceed to remove Large Media from my website.

Hi, @AG89z. We have removed the Large Media add-on from the site now.

Would you please push the commit removing .lfsconfig to the upstream repository? This will trigger a new build.

Please keep in mind that you might want to run the command below after deleting the .lfsconfig file:

git lfs push --all origin

This will sync the local repo’s LFS objects with the Git LFS service at the original Git host. It pushes any new binary blobs to their LFS service which may have been added after you moved the LFS service to Large Media.

Please let us know if there are any issues with the new build or deployed site.

Hi @luke , thank you, now the build is working :+1: