{"record":{"id":"5b23c01087d4f046","repo":"gitroomhq/postiz-app","slug":"the-file-is-corrupted-and-cannot-be-uploaded","errorCode":null,"errorMessage":"The file is corrupted and cannot be uploaded","messagePattern":"The file is corrupted and cannot be uploaded","errorType":"exception","errorClass":"BadBody","httpStatus":null,"severity":"error","filePath":"libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts","lineNumber":401,"sourceCode":"          },\n          '',\n          0,\n          true\n        )\n      ).json();\n    } catch (err) {\n      if (err instanceof RefreshToken) {\n        throw err;\n      }\n\n      // Transient status-check error: the media may finish processing just\n      // fine, keep polling - if Pinterest stays broken the workflow exhausts\n      // its checks and warns the user properly.\n      return { status: 'pending', pendingData };\n    }\n\n    if (mediafile.status === 'failed') {\n      throw new BadBody(\n        'pinterest',\n        JSON.stringify({}),\n        {} as any,\n        'The file is corrupted and cannot be uploaded'\n      );\n    }\n\n    if (mediafile.status !== 'succeeded') {\n      return { status: 'pending', pendingData };\n    }\n\n    return witness();\n  }\n\n  override async finalizePost(\n    accessToken: string,\n    pendingData: PinterestPendingData,\n    integration: Integration","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/libraries/nestjs-libraries/src/integrations/social/pinterest.provider.ts#L383-L419","documentation":"While polling Pinterest's media file status during checkPostStatus, the uploaded file reached status='failed', meaning Pinterest rejected/could not process the file. The pin will never be created from this file.","triggerScenarios":"Polling the Pinterest media upload returns status 'failed' — corrupt image, unsupported format, or Pinterest-side processing error.","commonSituations":"Corrupt or truncated uploads, CMYK/exotic image formats, files that fail Pinterest's validation, interrupted upload producing a broken file.","solutions":["Re-upload the original file (verify it opens locally)","Convert the image to a standard RGB JPEG/PNG within Pinterest size limits","Re-attach the media and retry the post"],"exampleFix":"// before\nuploadMedia('photo.cmyk.jpg');\n// after\nuploadMedia('photo.rgb.jpg'); // convert to sRGB JPEG before upload","handlingStrategy":"validation","validationCode":"const img = await sharp(file).metadata(); // throws on corrupt input\nif (!['jpeg','png','webp'].includes(img.format)) throw new Error('Unsupported format');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate/normalize images (sRGB JPEG/PNG) at upload time to the media library"],"tags":["pinterest","media-processing","corrupt-file"],"backgroundTag":"media-processing-failed","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}