I have the following SQL in a file, user.sql:
CREATE TABLE user ( user_id INTEGER PRIMARY KEY, username varchar(255), password varchar(255) );
I had exactly the same problem.
Then I noticed, my editor (Notepad++) reports Macintosh format for end of lines.
Converting eols into Unix style turned the script file into format, which sqlite3 understood.