Skip to content

[Apple Notes] get-note-content and update-note time out when Notes.app is not already running #25708

@jasondk

Description

@jasondk

Extension

https://www.raycast.com/raycast/apple-notes

Raycast Version

1.104.6

OS Version

26.2

Description

getNoteBody() and setNoteBody() in api/applescript.ts call runAppleScript() without specifying a timeout. The default in @raycast/utils is 10 seconds (10,000ms). When Notes.app is not already running, the AppleScript tell application "Notes" triggers an app launch, which can easily exceed 10 seconds.

The resulting error message is:

Error: Command timed out after undefined milliseconds: osascript

(The "undefined" is a cosmetic bug in @raycast/utils error reporting — options?.timeout is undefined because no options were passed, even though the actual timeout used was 10s.)

Suggested Fix

Pass an explicit timeout to runAppleScript in getNoteBody and setNoteBody:

export async function getNoteBody(id: string) {
  return runAppleScript(
    `
    tell application "Notes"
      set theNote to note id "${escapeDoubleQuotes(id)}"
      return body of theNote
    end tell
    `,
    { timeout: 30000 },
  );
}

export async function setNoteBody(id: string, body: string) {
  return runAppleScript(
    `
    tell application "Notes"
      set theNote to note id "${escapeDoubleQuotes(id)}"
      set body of theNote to "${escapeDoubleQuotes(body)}"
    end tell
    `,
    { timeout: 30000 },
  );
}

30 seconds provides enough headroom for Notes.app to launch, while still failing reasonably quickly if something is actually wrong.

Note: The "timed out after undefined milliseconds" phrasing in the error message is a separate minor bug in @raycast/utils — it reads options?.timeout for the error string, but when no options are passed, the timeout is applied internally as a default without being set on the options object.

Steps To Reproduce

  1. Quit Notes.app
  2. Ask the AI to read a note's content
  3. get-note-content calls getNoteBody()runAppleScript() with default 10s timeout
  4. Notes.app begins launching but doesn't finish within 10 seconds
  5. Timeout error

Current Behaviour

When Notes.app is not already running, get-note-content and update-note fail with:

Error: Command timed out after undefined milliseconds: osascript

The error occurs because the default 10-second timeout in @raycast/utils is too short for Notes.app to launch. The "undefined milliseconds" phrasing is a secondary cosmetic bug caused by the timeout not being explicitly set in the options object passed to runAppleScript.

Expected Behaviour

get-note-content and update-note should work reliably whether or not Notes.app is already running. With an explicit 30-second timeout passed to runAppleScript, Notes.app has sufficient time to launch and respond to the AppleScript command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingextensionIssues related to one of the extensions in the Storeextension: apple-notesIssues related to the apple-notes extension

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions