Failed to staple your application with code: 65

I am trying to package a Mac Electron app using Electron Forge capabilities. Code signing works fine, but there is a problem with notarising. I get "Finalizing package Failed to staple your application with code: 65". The notarize component of my forge.config.js is:

"osxNotarize: { tool: 'notarytool', appBundleId: 'com.ImmersiveDSP.ImmerGo-StudioLive', appleId: process.env.APPLE_ID, appleIdPassword: process.env.APPLE_PASSWORD, teamId: process.env.APPLE_TEAM_ID, }"

I provide my Apple ID and the app password in a terminal message together with npm run make. This worked in May this year, but now not. In a JSON response, I do get " reason = "Record not found". Anyone else had this issue and resolved it?

Is there a way that I can view my notarize requests and see what the issue is?

Replies

It’s hard to say what’s going on here because it’s tightly bound to third-party tools, and I don’t maintain expertise in those. However, the error 65 from stapler means that there’s no notarised ticket covering the item you’re trying to staple to.

Consider this:

% mkdir -p Test.app/Contents/MacOS
% trash Test.app 
% mkdir -p MyTrue.app/Contents/MacOS
% cp /usr/bin/true MyTrue.app/Contents/MacOS/MyTrue
% codesign -s - -f MyTrue.app
MyTrue.app: replacing existing signature
% stapler staple MyTrue.app 
Processing: /Users/quinn/Test/MyTrue.app
CloudKit query for MyTrue.app (2/c60f0a76c4fac950a8c36961e06aecbd6c08f3ca) failed due to "Record not found".
Could not find base64 encoded ticket in response for 2/c60f0a76c4fac950a8c36961e06aecbd6c08f3ca
The staple and validate action failed! Error 65.

I constructed a dummy app and signed it. When I staple, I get error 65 because my dummy app isn’t notarised.

There are a variety of potential causes of this problem. The most likely are:

  • Your forgot to actually notarise.

  • You notarised it but that failed, so no ticket was issued.

With regards the latter, you wrote:

Is there a way that I can view my notarize requests and see what the issue is?

Sure. See Fetching the Notary Log.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Quinn, thank you very much for this comprehensive response, and the associated code segment!

When I had the staple error, I did try and fetch the Notary log via this command:

xcrun notarytool log e78bfef8-5b53-410a-b00b-3319b16873b9 --apple-id "my apple ID" --team-id YQYPLL5DXU --password "my app password"

I received a reply that there was no log available.

However, on trying again to code-sign and notarize yesterday, the Electron-Forge procedure that I follow worked!

I think that the second scenario you mention was occurring - an attempt to staple without notarization occurring.

I will contact the Electron-Forge developers and see whether they can update to wait for ticket receipt before stapling.