The Spreadsheet vs Sheet object split
The most common cause is calling getRange on the wrong object. The Apps Script API has two classes that both expose getRange, and they resolve A1 notation differently. SpreadsheetApp.getActiveSpreadsheet() returns a Spreadsheet object. When you call getRange('A1') on that object, it expects the notation to include a sheet name prefix, like 'Data!A1'. Without it, the runtime has no sheet context to resolve against, so it throws Range not found.
The fix is almost always one line: get the Sheet object first. Call ss.getSheetByName('Data') or ss.getActiveSheet(), then call getRange('A1') on that. The Sheet object already carries its own sheet context, so bare A1 notation works.
The first time I hit this, I spent twenty minutes staring at a valid-looking address before noticing the object type in the variable name. Worth naming your variables ss for spreadsheet and sheet for the Sheet object from the start; the distinction stays visible in every line that follows.