The magnitude of the B-field is $a/r$ and circulates around the axis. By symmetry, *you understand* that the magnitude is zero on-axis. But if $a$ is anything but zero, your expression gives an infinite B-field magnitude. Therefore $a$ *must* be zero and therefore the B-field is also zero everywhere else inside the pipe.

The result also follows from Ampere's law. The line integral of the B-field around a closed circular loop inside the pipe, which encloses no current, should be zero. As the B-field is parallel to the line element (if $a$ is non-zero), you would get a non-zero line integral. Therefore both $a$ and the B-field must be zero.