Flutter iOS - archive failed, error: exit status 65

Bitrise Build Issue Report template

Description of the issue

On archive step, the build always fails with the error “archive failed, error: exit status 65”

▸ Touching Runner.app (in target ‘Runner’ from project ‘Runner’)
Last lines of the Xcode’s build log:
/usr/bin/codesign --force --sign A31575E7501284746CA3EC451288131715EA8917 --entitlements /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Runner.app.xcent --generate-entitlement-der /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app
RegisterExecutionPolicyException /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app (in target ‘Runner’ from project ‘Runner’)
cd /Users/[REDACTED]/git/ios
builtin-RegisterExecutionPolicyException /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app
Validate /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app (in target ‘Runner’ from project ‘Runner’)
cd /Users/[REDACTED]/git/ios
builtin-validationUtility /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app
Touch /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app (in target ‘Runner’ from project ‘Runner’)
cd /Users/[REDACTED]/git/ios
/usr/bin/touch -c /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Runner-fvdlvfvunbwmbcgkbjykdeexifra/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app
** ARCHIVE FAILED **
The following build commands failed:
Run custom shell script ‘Run Script’
(1 failure)
You can find the last couple of lines of Xcode’s build log above, but the full log will be also available in the raw-xcodebuild-output.log
The log file will be stored in $BITRISE_DEPLOY_DIR, and its full path will be available in the $BITRISE_XCODE_RAW_RESULT_TEXT_PATH environment variable.
Exporting outputs…
The xcodebuild archive log path is now available in the Environment Variable: BITRISE_XCODEBUILD_ARCHIVE_LOG_PATH (value: /Users/[REDACTED]/deploy/xcodebuild-archive.log)
archive failed, error: exit status 65

Does anyone have ideas why archiving is failing all the time?