meant to say " but fails on all OTHER images"
The only way to determine if a keyword exists is to examine the appropriate part of the hierarchy (or the entire hierarchy, if you don't know where the keyword might be). But you only need to do that once per export.
You could store the keyword in the LrExportSession object under your own key. E.g.
if session.myKeyword == nil then
session.myKeyword = look up keyword, creating it if necessary
That way, you don't have to look up the keyword for each photo.
Also, if you know the parent keyword of the keyword you're looking for, you can use the "returnExisting" parameter of catalog:createKeyword() to create the keyword (if it doesn't exist) or return it (if it does exist).
This is exactly what I needed, thanks for the pointer.