How should capital and labor be taxed when individuals' labor income is subject to unin- surable idiosyncratic risks? To address this question, we develop a tractable infinite horizon model with incomplete markets and consider a dynamic optimal taxation problem with linear taxes on the wage and interest income. We derive two general principles for public policy in such an environment: (i) providing an insurance for the idiosyncratic income risks; and (ii) allocating tax burdens efficiently over time. The first principle calls for taxing the labor income. The second principle clarifies when accumulating government debt is welfare improving, and also when the tax rate on physical capital needs to be strictly positive in the long run. We also calibrate our model to the U.S. economy and find that the presence of idiosyncratic income risks significantly affects the optimal tax rates and the optimal amount of the government debt.