Custom permalink variable on single post

Use add_rewrite_endpoint instead of adding a new rewrite rule:

function wpa_chapter_endpoint(){
    add_rewrite_endpoint( 'chapter', EP_PERMALINK );
}
add_action( 'init', 'wpa_chapter_endpoint' );

error code: 523