An Australian citizen was unlawfully held in immigration detention for 945 days due to a litany of departmental errors.