import: return correct error when import target exists in state but not config (#38782)