Check for max_length only when output is required in text format